fix a null reference exception in parentKey

This commit is contained in:
Matthias Mailänder
2015-06-13 10:52:23 +02:00
parent b98d98c6d6
commit 0816251bcd

View File

@@ -369,13 +369,16 @@ namespace OpenRA.Mods.Common.UtilityCommands
// GiveUnitCrateAction and GiveMcvCrateAction were updated to allow multiple units // GiveUnitCrateAction and GiveMcvCrateAction were updated to allow multiple units
if (engineVersion < 20140723) if (engineVersion < 20140723)
{ {
if (depth == 2 && parentKey.Contains("GiveMcvCrateAction")) if (depth == 2 && !string.IsNullOrEmpty(parentKey))
if (node.Key == "Unit") {
node.Key = "Units"; if (parentKey.Contains("GiveMcvCrateAction"))
if (node.Key == "Unit")
node.Key = "Units";
if (depth == 2 && parentKey.Contains("GiveUnitCrateAction")) if (parentKey.Contains("GiveUnitCrateAction"))
if (node.Key == "Unit") if (node.Key == "Unit")
node.Key = "Units"; node.Key = "Units";
}
} }
// Power from Building was moved out into Power and ScalePowerWithHealth traits // Power from Building was moved out into Power and ScalePowerWithHealth traits