Sculpt mode requires mask customdata layer for multires and ensures it exists on entering sculpt mode. However, sculpt mode only considers multires to be active if the level of subdivision is not zero, so it does not add mask for unsubdivided multires meshes. If the multires mesh is subdivided while in sculpt mode, no mask was present leading to weird drawing and crash on use of the mask brush. Fixed by doing the same thing in multires_subdivide_exec() that is done in ED_object_modifier_add(), which is to check if sculpt mode is active and add mask layer if so. Fixes [#34190] Viewport artifacts when using Multiresolution modifier projects.blender.org/tracker/index.php?func=detail&aid=34190&group_id=9&atid=498