From 21c150fae3c988bb2e4c0a2040fd4745b7fd93e9 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Tue, 28 Jun 2016 22:46:00 +0100 Subject: [PATCH] Throw a sensible exception when an invalid path is given. --- OpenRA.Mods.Common/UtilityCommands/UpgradeMapCommand.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/OpenRA.Mods.Common/UtilityCommands/UpgradeMapCommand.cs b/OpenRA.Mods.Common/UtilityCommands/UpgradeMapCommand.cs index 60228e4f8f..81e4c74ec9 100644 --- a/OpenRA.Mods.Common/UtilityCommands/UpgradeMapCommand.cs +++ b/OpenRA.Mods.Common/UtilityCommands/UpgradeMapCommand.cs @@ -11,6 +11,7 @@ using System; using System.Collections.Generic; +using System.IO; using System.Text; using OpenRA.FileSystem; @@ -80,6 +81,9 @@ namespace OpenRA.Mods.Common.UtilityCommands // HACK: We know that maps can only be oramap or folders, which are ReadWrite var package = modData.ModFiles.OpenPackage(args[1], new Folder(".")) as IReadWritePackage; + if (package == null) + throw new FileNotFoundException(args[1]); + var engineDate = Exts.ParseIntegerInvariant(args[2]); UpgradeMap(modData, package, engineDate); }