Fix crash running Blender in background mode, caused by revision 60633.
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Sat, 12 Oct 2013 00:08:33 +0000 (00:08 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Sat, 12 Oct 2013 00:08:33 +0000 (00:08 +0000)
source/blender/editors/sculpt_paint/paint_cursor.c

index 99339cea99522cd4a1ee5ddaa3de617a6f78f84e..56143d00afebb249bf85839f5cbe633fbe3baa51 100644 (file)
@@ -91,9 +91,12 @@ static CursorSnapshot cursor_snap  = {0};
 /* delete overlay cursor textures to preserve memory and invalidate all overlay flags */
 void paint_cursor_delete_textures(void)
 {
-       glDeleteTextures(1, &primary_snap.overlay_texture);
-       glDeleteTextures(1, &secondary_snap.overlay_texture);
-       glDeleteTextures(1, &cursor_snap.overlay_texture);
+       if (primary_snap.overlay_texture)
+               glDeleteTextures(1, &primary_snap.overlay_texture);
+       if (secondary_snap.overlay_texture)
+               glDeleteTextures(1, &secondary_snap.overlay_texture);
+       if (cursor_snap.overlay_texture)
+               glDeleteTextures(1, &cursor_snap.overlay_texture);
 
        memset(&primary_snap, 0, sizeof(TexSnapshot));
        memset(&secondary_snap, 0, sizeof(TexSnapshot));