Add a missing check for undefined resource costs when picking the unit portrait in observermode. Patch by Imarok, fixes #4269.

This was SVN commit r18809.
This commit is contained in:
elexis 2016-10-07 17:57:03 +00:00
parent bb438eca09
commit 3c72c16d6c

View File

@ -897,7 +897,7 @@ function updateGroups()
let getCostSum = (template) =>
{
let cost = GetTemplateData(template).cost;
return Object.keys(cost).map(key => cost[key]).reduce((sum, cur) => sum + cur);
return cost ? Object.keys(cost).map(key => cost[key]).reduce((sum, cur) => sum + cur) : 0;
};
for (let i in Engine.GetGUIObjectByName("unitGroupPanel").children)