Bugfix #11717:
authorJoshua Leung <aligorith@gmail.com>
Sat, 17 May 2008 00:35:30 +0000 (00:35 +0000)
committerJoshua Leung <aligorith@gmail.com>
Sat, 17 May 2008 00:35:30 +0000 (00:35 +0000)
Rendering (Internal/OGL) would crash when StampInfo was on and adding info about the active camera, if there was no camera in the scene.

source/blender/blenkernel/intern/image.c

index bc44bfa988df74a1998cb5ecac7c38046f0e6359..b2557c9c07efb4248381d6016fa347c98183e975 100644 (file)
@@ -990,8 +990,11 @@ static void stampdata(StampData *stamp_data, int do_prefix)
        }
 
        if (G.scene->r.stamp & R_STAMP_CAMERA) {
-               if (do_prefix)          sprintf(stamp_data->camera, "Camera %s", ((Camera *) G.scene->camera)->id.name+2);
-               else                            sprintf(stamp_data->camera, "%s", ((Camera *) G.scene->camera)->id.name+2);
+               if (G.scene->camera) strcpy(text, ((Camera *) G.scene->camera)->id.name+2);
+               else            strcpy(text, "<none>");
+               
+               if (do_prefix)          sprintf(stamp_data->camera, "Camera %s", text);
+               else                            sprintf(stamp_data->camera, "%s", text);
        } else {
                stamp_data->camera[0] = '\0';
        }