Bugfix #18519
authorTon Roosendaal <ton@blender.org>
Tue, 21 Apr 2009 13:30:58 +0000 (13:30 +0000)
committerTon Roosendaal <ton@blender.org>
Tue, 21 Apr 2009 13:30:58 +0000 (13:30 +0000)
MultiLayer save (F3) crashes when no rendering/layers exist, happens for
opengl preview render. It now survives, saving empty file and prints error.

Better solution for later: render profiles!

source/blender/imbuf/intern/openexr/openexr_api.cpp

index 3e618a483e352ca8b8ebf981b5de9cd84035d941..9e077cbc8093aabc977a0afcca716d1fc1648edb 100644 (file)
@@ -570,13 +570,17 @@ void IMB_exr_write_channels(void *handle)
        FrameBuffer frameBuffer;
        ExrChannel *echan;
        
-       for(echan= (ExrChannel *)data->channels.first; echan; echan= echan->next)
-               frameBuffer.insert (echan->name, Slice (FLOAT,  (char *)echan->rect, 
-                                                                                               echan->xstride*sizeof(float), echan->ystride*sizeof(float)));
-       
-       data->ofile->setFrameBuffer (frameBuffer);
-       data->ofile->writePixels (data->height);        
-       
+       if(data->channels.first) {
+               for(echan= (ExrChannel *)data->channels.first; echan; echan= echan->next)
+                       frameBuffer.insert (echan->name, Slice (FLOAT,  (char *)echan->rect, 
+                                                                                                       echan->xstride*sizeof(float), echan->ystride*sizeof(float)));
+               
+               data->ofile->setFrameBuffer (frameBuffer);
+               data->ofile->writePixels (data->height);        
+       }
+       else {
+               printf("Error: attempt to save MultiLayer without layers.\n");
+       }
 }
 
 void IMB_exr_read_channels(void *handle)