Fix T59391: Crash snapping to active
authorSebastian Parborg <zeddb>
Wed, 19 Dec 2018 19:51:28 +0000 (06:51 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 19 Dec 2018 19:51:28 +0000 (06:51 +1100)
source/blender/editors/space_view3d/view3d_snap.c

index 7ecd63d43e8d1dc42dcee85df1fd4df9265bd442..dbf2271e114d11dfe56fe711ad00b7f143a65eee 100644 (file)
@@ -759,6 +759,9 @@ void VIEW3D_OT_snap_cursor_to_selected(wmOperatorType *ot)
 static bool snap_calc_active_center(bContext *C, const bool select_only, float r_center[3])
 {
        Object *ob = CTX_data_active_object(C);
+       if (ob == NULL) {
+               return false;
+       }
        return ED_object_calc_active_center(ob, select_only, r_center);
 }