From ee9a8ce4b7218d84404e49f4778878008b85f483 Mon Sep 17 00:00:00 2001 From: m!nus Date: Sun, 26 May 2013 10:58:03 +0200 Subject: [PATCH] prevent map editor from crashing if loaded map is invalid --- src/game/editor/editor.cpp | 5 +++++ src/game/editor/io.cpp | 3 +++ 2 files changed, 8 insertions(+) diff --git a/src/game/editor/editor.cpp b/src/game/editor/editor.cpp index e7b917f4d..5e8c2407d 100644 --- a/src/game/editor/editor.cpp +++ b/src/game/editor/editor.cpp @@ -711,6 +711,11 @@ void CEditor::CallbackOpenMap(const char *pFileName, int StorageType, void *pUse pEditor->m_Dialog = DIALOG_NONE; pEditor->m_Map.m_Modified = false; } + else + { + pEditor->Reset(); + pEditor->m_aFileName[0] = 0; + } } void CEditor::CallbackAppendMap(const char *pFileName, int StorageType, void *pUser) { diff --git a/src/game/editor/io.cpp b/src/game/editor/io.cpp index 529638cfb..641ec81ba 100644 --- a/src/game/editor/io.cpp +++ b/src/game/editor/io.cpp @@ -435,6 +435,7 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag editor->reset(); editor_load_old(df, this); */ + return 0; } else if(pItem->m_Version == 1) { @@ -650,6 +651,8 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag } } } + else + return 0; return 1; }