From 0816251bcd06ba09a604c655fa613c003e76a033 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sat, 13 Jun 2015 10:52:23 +0200 Subject: [PATCH 1/3] fix a null reference exception in parentKey --- .../UtilityCommands/UpgradeRules.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs index 34b722971a..27661e6e36 100644 --- a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs +++ b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs @@ -369,13 +369,16 @@ namespace OpenRA.Mods.Common.UtilityCommands // GiveUnitCrateAction and GiveMcvCrateAction were updated to allow multiple units if (engineVersion < 20140723) { - if (depth == 2 && parentKey.Contains("GiveMcvCrateAction")) - if (node.Key == "Unit") - node.Key = "Units"; + if (depth == 2 && !string.IsNullOrEmpty(parentKey)) + { + if (parentKey.Contains("GiveMcvCrateAction")) + if (node.Key == "Unit") + node.Key = "Units"; - if (depth == 2 && parentKey.Contains("GiveUnitCrateAction")) - if (node.Key == "Unit") - node.Key = "Units"; + if (parentKey.Contains("GiveUnitCrateAction")) + if (node.Key == "Unit") + node.Key = "Units"; + } } // Power from Building was moved out into Power and ScalePowerWithHealth traits From d7e63ec28ad60111d5dee6bd5a245d9e0d3c5dab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sat, 13 Jun 2015 10:53:48 +0200 Subject: [PATCH 2/3] fix a NullReferenceException --- OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs index 27661e6e36..00e47098ea 100644 --- a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs +++ b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs @@ -1101,7 +1101,7 @@ namespace OpenRA.Mods.Common.UtilityCommands var chPal = nodeChPal != null && !string.IsNullOrEmpty(nodeChPal.Value.Value) ? nodeChPal.Value.Value : "effect"; ge.Value.Nodes.Remove(nodeChPal); - if (upgrades != 0) + if (upgrades != 0 && nodeUpgrades != null) { foreach (var nodeUpgrade in nodeUpgrades.Value.Nodes) nodeUpgrade.Value.Value = "rank" + (string.IsNullOrEmpty(nodeUpgrade.Value.Value) ? null : ", ") + nodeUpgrade.Value.Value; From 1bf2bfadb428694b490e5d1cd7243e26eb0f482d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sat, 13 Jun 2015 10:54:03 +0200 Subject: [PATCH 3/3] update the engine version as the merge was delayed --- OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs index 00e47098ea..765bb75321 100644 --- a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs +++ b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs @@ -1123,7 +1123,7 @@ namespace OpenRA.Mods.Common.UtilityCommands } // Images from WithCrateBody was moved into RenderSprites - if (engineVersion < 20150530) + if (engineVersion < 20150608) { if (depth == 0) {