fix for crash when entering fly mode in a camera view that has no camera (rare but possible situation).

This commit is contained in:
Campbell Barton 2012-10-10 08:46:52 +00:00
parent cc8c0d89e3
commit 33489b3b74

@ -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;