Fix possible crash in various 3D View operators

Was actually harmeless and not crashing, but I'd say more or less only
by luck: the NULL-check for region data would only evaluate to true for
the correct 3D View region. However, if we were to add region data to a
different region type in future, this would lead to undefined behavior
if executed in the wrong region.
This commit is contained in:
Julian Eisel 2017-02-23 01:59:40 +01:00
parent 43299f9465
commit 7359cc1060
Notes: blender-bot 2023-10-13 01:54:23 +02:00
Referenced by issue #50688, exporting instance groups to alembic results in empties with no geometry
1 changed files with 2 additions and 2 deletions

View File

@ -180,8 +180,8 @@ bool ED_view3d_context_user_region(bContext *C, View3D **r_v3d, ARegion **r_ar)
View3D *v3d = (View3D *)sa->spacedata.first;
if (ar) {
RegionView3D *rv3d = ar->regiondata;
if (rv3d && (rv3d->viewlock & RV3D_LOCKED) == 0) {
RegionView3D *rv3d;
if ((ar->regiontype == RGN_TYPE_WINDOW) && (rv3d = ar->regiondata) && (rv3d->viewlock & RV3D_LOCKED) == 0) {
*r_v3d = v3d;
*r_ar = ar;
return true;