Fix potential crash for file operators that don't define
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 28 Sep 2009 16:11:06 +0000 (16:11 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 28 Sep 2009 16:11:06 +0000 (16:11 +0000)
a "path" property, now it will just give a warning.

source/blender/windowmanager/intern/wm_event_system.c

index 846309f12652add7fb0ccdb9bf201ada28e8148f..b7156a17383f51bde2eb84b69fafaf016245409a 100644 (file)
@@ -943,7 +943,7 @@ static int wm_handler_fileselect_call(bContext *C, ListBase *handlers, wmEventHa
                                        /* XXX also extension code in image-save doesnt work for this yet */
                                        if(strncmp(handler->op->type->name, "Save", 4)==0) {
                                                /* this gives ownership to pupmenu */
-                                               uiPupMenuSaveOver(C, handler->op, path);
+                                               uiPupMenuSaveOver(C, handler->op, (path)? path: "");
                                        }
                                        else {
                                                int retval= handler->op->type->exec(C, handler->op);
@@ -961,7 +961,8 @@ static int wm_handler_fileselect_call(bContext *C, ListBase *handlers, wmEventHa
                                        WM_operator_free(handler->op);
                                
                                wm_event_free_handler(handler);
-                               MEM_freeN(path);
+                               if(path)
+                                       MEM_freeN(path);
                                
                                action= WM_HANDLER_BREAK;
                        }