Fix T38435: Crash when pressing MMB in walk mode

Snap code may be called with a NULL region, add check about this and assume ray_start is OK in this case!
This commit is contained in:
Bastien Montagne 2014-02-02 20:34:23 +01:00
parent c0e6a0d318
commit 482823a1ab
Notes: blender-bot 2023-02-14 11:16:52 +01:00
Referenced by issue #38435, Crash when pressing MMB in walk mode
Referenced by issue #38401, Metropolis Sampling
1 changed files with 2 additions and 1 deletions

View File

@ -1542,8 +1542,9 @@ static bool snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMes
/* Only use closer ray_start in case of ortho view! In perspective one, ray_start may already
* been *inside* boundbox, leading to snap failures (see T38409).
* Note also ar might be null (see T38435), in this case we assume ray_start is ok!
*/
if (!((RegionView3D *)ar->regiondata)->is_persp) {
if (ar && !((RegionView3D *)ar->regiondata)->is_persp) {
float ray_org_local[3];
copy_v3_v3(ray_org_local, ray_origin);