diff options
-rw-r--r-- | source/blender/editors/gpencil/gpencil_paint.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 93963b3f7ed..2311f4a3a64 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -1728,7 +1728,12 @@ static int gpencil_draw_modal (bContext *C, wmOperator *op, wmEvent *event) /* just delete last stroke, which will look like undo to the end user */ //printf("caught attempted undo event... deleting last stroke \n"); gpencil_frame_delete_laststroke(p->gpl, p->gpf); - + /* undoing the last line can free p->gpf + * note, could do this in a bit more of an elegant way then a search but it at least prevents a crash */ + if(BLI_findindex(&p->gpl->frames, p->gpf) == -1) { + p->gpf= NULL; + } + /* event handled, so force refresh */ ED_region_tag_redraw(p->ar); /* just active area for now, since doing whole screen is too slow */ estate = OPERATOR_RUNNING_MODAL; |