Procházet zdrojové kódy

Merge pull request #235 from chaigler/fix_gui_editor_crash

Fix crash due to GuiEditCanvas::save()
Brian Roberts před 5 roky
rodič
revize
aa897d0242

+ 7 - 1
Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorCanvas.ed.cs

@@ -436,7 +436,13 @@ function GuiEditCanvas::save( %this, %selectedOnly, %noPrompt )
       %fileObject.delete();
      
       %fo = new FileObject();
-      %fo.openForWrite(%filename);
+      if(!%fo.openForWrite(%filename))
+      {
+        error("GuiEditCanvas::save() - Unable to save, file location not open for writing.");
+        %fo.close();
+             
+        return false;
+      }
       
       // Write out the captured TorqueScript that was before the object before the object
       for( %i = 0; %i <= %beforeLines; %i++)