Fix: Sculpt redo crash after undoing addition of mask

Fixes a crash in the following case:
Enter sculpt mode -> draw face set -> draw sculpt -> undo * 3 -> redo * 3
This commit is contained in:
Hans Goudey 2023-11-02 16:40:30 +01:00
parent 67445c2353
commit db5cae78b7
1 changed files with 4 additions and 0 deletions

View File

@ -576,6 +576,10 @@ static bool sculpt_undo_restore_mask(bContext *C, SculptUndoNode *unode, bool *m
/* Regular mesh restore. */
float *vmask = static_cast<float *>(
CustomData_get_layer_for_write(&mesh->vert_data, CD_PAINT_MASK, mesh->totvert));
if (!vmask) {
vmask = static_cast<float *>(
CustomData_add_layer(&mesh->vert_data, CD_PAINT_MASK, CD_SET_DEFAULT, mesh->totvert));
}
ss->vmask = vmask;
index = unode->index;