From bf2513407a2e2f49049ec46154a8d76a74c5f3e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Fri, 1 Jan 2016 12:27:04 +0100 Subject: [PATCH] fix a crash on new map creation --- .../Widgets/Logic/Editor/SaveMapLogic.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/Widgets/Logic/Editor/SaveMapLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Editor/SaveMapLogic.cs index 729b592a04..0064052c72 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Editor/SaveMapLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Editor/SaveMapLogic.cs @@ -93,8 +93,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic directoryDropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 210, mapDirectories.Keys, setupItem); } - var attr = File.GetAttributes(map.Path); - var mapIsUnpacked = attr.HasFlag(FileAttributes.Directory); + var mapIsUnpacked = false; + + if (map.Path != null) + { + var attr = File.GetAttributes(map.Path); + mapIsUnpacked = attr.HasFlag(FileAttributes.Directory); + } + var filename = widget.Get("FILENAME"); filename.Text = mapIsUnpacked ? Path.GetFileName(map.Path) : Path.GetFileNameWithoutExtension(map.Path); var fileType = mapIsUnpacked ? MapFileType.Unpacked : MapFileType.OraMap;