fix [#28296] File selector crash when with filepath property
authorCampbell Barton <ideasman42@gmail.com>
Thu, 2 Feb 2012 05:55:01 +0000 (05:55 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 2 Feb 2012 05:55:01 +0000 (05:55 +0000)
disable browsing a file property within the file selector to avoid a crash.

source/blender/editors/space_buttons/buttons_ops.c

index b1a25d093d2cebc6d45e0d4d9dfdfbadeeeb3479..26516bcda990626c3fc96ab6084fce964bfadadc 100644 (file)
@@ -43,6 +43,7 @@
 #include "BKE_context.h"
 #include "BKE_global.h"
 #include "BKE_main.h"
+#include "BKE_report.h"
 
 #include "WM_api.h"
 #include "WM_types.h"
@@ -160,6 +161,11 @@ static int file_browse_invoke(bContext *C, wmOperator *op, wmEvent *event)
        FileBrowseOp *fbo;
        char *str;
 
+       if (CTX_wm_space_file(C)) {
+               BKE_report(op->reports, RPT_ERROR, "Can't activate a file selector, one already open");
+               return OPERATOR_CANCELLED;
+       }
+
        uiFileBrowseContextProperty(C, &ptr, &prop);
 
        if(!prop)