diff --git a/Source/Core/General/MapManager.cs b/Source/Core/General/MapManager.cs index f0d8bd85a9842c0e9edbb4be2214cb1ee8b17e09..610c2101261792ab77af728c4de4357360b4537b 100644 --- a/Source/Core/General/MapManager.cs +++ b/Source/Core/General/MapManager.cs @@ -453,6 +453,7 @@ namespace CodeImp.DoomBuilder { // Create map data MapSet newmap = new MapSet(); + WAD mapwad; // Create temp wadfile string tempfile = General.MakeTempFilename(temppath); @@ -462,25 +463,24 @@ namespace CodeImp.DoomBuilder { #if DEBUG tempwad = new WAD(tempfile); #else - try { tempwad = new WAD(tempfile); } - catch(Exception e) - { - General.ShowErrorMessage("Error while creating a temporary wad file:\n" + e.GetType().Name + ": " + e.Message, MessageBoxButtons.OK); - return false; - } + try { tempwad = new WAD(tempfile); } catch(Exception e) + { + General.ShowErrorMessage("Error while creating a temporary wad file:\n" + e.GetType().Name + ": " + e.Message, MessageBoxButtons.OK); + return false; + } #endif // Now open the map file General.WriteLogLine("Opening source file: " + filepathname); + #if DEBUG - WAD mapwad = new WAD(filepathname, true); + mapwad = new WAD(filepathname, true); #else - try { mapwad = new WAD(filepathname, true); } - catch(Exception e) - { - General.ShowErrorMessage("Error while opening source wad file:\n" + e.GetType().Name + ": " + e.Message, MessageBoxButtons.OK); - return false; - } + try { mapwad = new WAD(filepathname, true); } catch(Exception e) + { + General.ShowErrorMessage("Error while opening source wad file:\n" + e.GetType().Name + ": " + e.Message, MessageBoxButtons.OK); + return false; + } #endif // Copy the map lumps to the temp file @@ -498,13 +498,12 @@ namespace CodeImp.DoomBuilder { #if DEBUG newmap = io.Read(newmap, TEMP_MAP_HEADER); #else - try { newmap = io.Read(newmap, TEMP_MAP_HEADER); } - catch(Exception e) - { - General.ErrorLogger.Add(ErrorType.Error, "Unable to read the map data structures with the specified configuration. " + e.GetType().Name + ": " + e.Message); - General.ShowErrorMessage("Unable to read the map data structures with the specified configuration.", MessageBoxButtons.OK); - return false; - } + try { newmap = io.Read(newmap, TEMP_MAP_HEADER); } catch(Exception e) + { + General.ErrorLogger.Add(ErrorType.Error, "Unable to read the map data structures with the specified configuration. " + e.GetType().Name + ": " + e.Message); + General.ShowErrorMessage("Unable to read the map data structures with the specified configuration.", MessageBoxButtons.OK); + return false; + } #endif newmap.EndAddRemove();