Add a NULL check for the View3D's camera, because these modes can be entered even without an active camera.