Spoilage bar crash

Not a big bug this time or, I suspect, one that anyone else cares about. In the resource menu and storage building, you can see the spoilage bar for a specific type of item:

This is very helpful. However, if you click on an item with 0 quantity, this bar crashes, and all following bars until reloading a game will be fully green.

I’m fairly sure that the root of the problem is in UIResourceProductionDetails.UpdateDynamicData there’s a block of code

	if (item.doesDegrade)
	{
		float num = this.itemInfo.unusedCount;
		float num2 = this.itemInfo.numAt25Percent / num;
		float num3 = num2 + this.itemInfo.numAt50Percent / num;
		float num4 = num2 + num3 + this.itemInfo.numAt75Percent / num;

that calculates the values for the bar, but no division by 0 check for unusedcount.


For anyone worried about my sanity and how I find these things, I was trying to implement this idea idea myself and ran into this exact problem.

1 Like

Cool! I’ve been experiencing this “green bar” bug since long time but I wasn’t able to find what is causing it. Very good if a fix can be found for this annoying bug.