add an assert because if the mesh is in an invalid state the mask layer can exist but the mask pointer still be NULL (noticed this while looking into a different bug).
add an assert because if the mesh is in an invalid state the mask layer can exist but the mask pointer still be NULL (noticed this while looking into a different bug).