fix for crash when entering fly mode in a camera view that has no camera (rare but...
authorCampbell Barton <ideasman42@gmail.com>
Wed, 10 Oct 2012 08:46:52 +0000 (08:46 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 10 Oct 2012 08:46:52 +0000 (08:46 +0000)
source/blender/editors/space_view3d/view3d_fly.c

index c743b88e88900f74a978cf1360b06dabde2a1fc1..cd358dea869318ffe7285162a392a75685fac4a5 100644 (file)
@@ -284,6 +284,11 @@ static int initFlyInfo(bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *event
        puts("\n-- fly begin --");
 #endif
 
+       /* sanity check: for rare but possible case (if lib-linking the camera fails) */
+       if ((fly->rv3d->persp == RV3D_CAMOB) && (fly->v3d->camera == NULL)) {
+               fly->rv3d->persp = RV3D_PERSP;
+       }
+
        if (fly->rv3d->persp == RV3D_CAMOB && fly->v3d->camera->id.lib) {
                BKE_report(op->reports, RPT_ERROR, "Cannot fly a camera from an external library");
                return FALSE;