From e4a2df9fec4859609106179715af54eed608a29f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 21 Apr 2014 18:11:47 +1000 Subject: View2d: check UI_view2d_view_to_region_clip succeeds before using the result --- source/blender/editors/space_clip/clip_graph_ops.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source/blender/editors/space_clip/clip_graph_ops.c') diff --git a/source/blender/editors/space_clip/clip_graph_ops.c b/source/blender/editors/space_clip/clip_graph_ops.c index 074d76c1a41..8596c8fb19a 100644 --- a/source/blender/editors/space_clip/clip_graph_ops.c +++ b/source/blender/editors/space_clip/clip_graph_ops.c @@ -193,10 +193,10 @@ static bool mouse_select_knot(bContext *C, float co[2], bool extend) if (userdata.marker) { int x1, y1, x2, y2; - UI_view2d_view_to_region_clip(v2d, co[0], co[1], &x1, &y1); - UI_view2d_view_to_region_clip(v2d, userdata.min_co[0], userdata.min_co[1], &x2, &y2); - - if (abs(x2 - x1) <= delta && abs(y2 - y1) <= delta) { + if (UI_view2d_view_to_region_clip(v2d, co[0], co[1], &x1, &y1) && + UI_view2d_view_to_region_clip(v2d, userdata.min_co[0], userdata.min_co[1], &x2, &y2) && + (abs(x2 - x1) <= delta && abs(y2 - y1) <= delta)) + { if (!extend) { SelectUserData selectdata = {SEL_DESELECT}; -- cgit v1.2.3