diff options
author | Lukas Stockner <lukas.stockner@freenet.de> | 2019-07-31 22:13:29 +0300 |
---|---|---|
committer | Lukas Stockner <lukas.stockner@freenet.de> | 2019-07-31 22:24:34 +0300 |
commit | ea3690e32974005c6ccb871f4e2f49471ad837ab (patch) | |
tree | d7145b6ed375599ee5534c5a1cd102012baf8150 /source/blender/editors | |
parent | 77d7cc9ba7a9c23c269cb89e8f6da9c800558973 (diff) |
Fix several undefined-behaviour-sanitizer warnings
Reviewers: brecht
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D4222
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_ops.c | 8 | ||||
-rw-r--r-- | source/blender/editors/space_text/space_text.c | 3 |
2 files changed, 9 insertions, 2 deletions
diff --git a/source/blender/editors/gpencil/gpencil_ops.c b/source/blender/editors/gpencil/gpencil_ops.c index db4c601709c..d259bb9183c 100644 --- a/source/blender/editors/gpencil/gpencil_ops.c +++ b/source/blender/editors/gpencil/gpencil_ops.c @@ -81,9 +81,15 @@ static bool gp_stroke_paintmode_poll_with_tool(bContext *C, const char gpencil_t { /* TODO: limit this to mode, but review 2D editors */ bGPdata *gpd = CTX_data_gpencil_data(C); + if (!gpd) + return false; + ToolSettings *ts = CTX_data_tool_settings(C); + if (!ts || !ts->gp_paint) + return false; + Brush *brush = BKE_paint_brush(&ts->gp_paint->paint); - return ((gpd) && (gpd->flag & GP_DATA_STROKE_PAINTMODE) && (brush && brush->gpencil_settings) && + return ((gpd->flag & GP_DATA_STROKE_PAINTMODE) && (brush && brush->gpencil_settings) && WM_toolsystem_active_tool_is_brush(C) && (brush->gpencil_tool == gpencil_tool)); } diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c index 24f282ff920..70985bbb072 100644 --- a/source/blender/editors/space_text/space_text.c +++ b/source/blender/editors/space_text/space_text.c @@ -254,7 +254,8 @@ static int text_context(const bContext *C, const char *member, bContextDataResul return 1; } else if (CTX_data_equals(member, "edit_text")) { - CTX_data_id_pointer_set(result, &st->text->id); + if (st->text) + CTX_data_id_pointer_set(result, &st->text->id); return 1; } |