Fix possible dereference of nullptr mask

This commit is contained in:
Sergey Sharybin
2021-01-27 16:54:09 +01:00
parent 0af512abdf
commit ded4940901

View File

@@ -609,17 +609,17 @@ bool ED_mask_selected_minmax(const bContext *C, float min[2], float max[2], bool
Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
Mask *mask = CTX_data_edit_mask(C); Mask *mask = CTX_data_edit_mask(C);
/* Use evaluated mask to take animation into account.
* The animation of splies is not "flushed" back to original, so need to explicitly
* sue evaluated datablock here. */
Mask *mask_eval = (Mask *)DEG_get_evaluated_id(depsgraph, &mask->id);
bool ok = false; bool ok = false;
if (mask == NULL) { if (mask == NULL) {
return ok; return ok;
} }
/* Use evaluated mask to take animation into account.
* The animation of splies is not "flushed" back to original, so need to explicitly
* sue evaluated datablock here. */
Mask *mask_eval = (Mask *)DEG_get_evaluated_id(depsgraph, &mask->id);
INIT_MINMAX2(min, max); INIT_MINMAX2(min, max);
for (MaskLayer *mask_layer = mask_eval->masklayers.first; mask_layer != NULL; for (MaskLayer *mask_layer = mask_eval->masklayers.first; mask_layer != NULL;
mask_layer = mask_layer->next) { mask_layer = mask_layer->next) {