fix T50602: Avoid crash when executing `transform_snap_context_project_view3d_mixed` with `dist_px` NULL

This commit is contained in:
Germano Cavalcante 2017-02-06 01:01:39 -03:00
parent da08aa4b96
commit 22156d951d
Notes: blender-bot 2023-02-14 08:24:03 +01:00
Referenced by issue #50602, extrude shortcut while snap to face is selected crash blender
1 changed files with 4 additions and 2 deletions

View File

@ -2028,11 +2028,13 @@ static bool transform_snap_context_project_view3d_mixed_impl(
BLI_assert((snap_to_flag & ~(1 | 2 | 4)) == 0);
if (use_depth) {
const float dist_px_orig = *dist_px;
const float dist_px_orig = dist_px ? *dist_px : 0;
for (int i = 2; i >= 0; i--) {
if (snap_to_flag & (1 << i)) {
if (i == 0)
if (i == 0) {
BLI_assert(dist_px != NULL);
*dist_px = dist_px_orig;
}
if (ED_transform_snap_object_project_view3d(
sctx,
elem_type[i], params,