shpaass / yafc-ce

Powerful Factorio calculator/analyser that works with mods
GNU General Public License v3.0
40 stars 15 forks source link

Fix an exception when recipe-hovering with a pathological configuration. #150

Closed DaleStan closed 1 month ago

DaleStan commented 1 month ago

Specifically, an ArgumentOutOfRangeException happens when hovering over a recipe that is unlocked by a technology that (directly or indirectly) requires a science pack that is both (a) inaccessible and (b) not a milestone.

For an example of this in action, load this vanilla project and hover over either of the two personal roboport recipe icons. Both will cause an exception, but the steel recipe icon won't. Open the milestones editor and add Chemical science pack to the milestones. Alternatively, open the Dependency explorer for the Chemical science pack item, and click "Clear mark". In both cases, the exceptions will disappear.

shpaass commented 1 month ago

Open the milestones editor and add Chemical science pack to the milestones. Alternatively, open the Dependency explorer for the Chemical science pack item, and click "Clear mark". In both cases, the exceptions will disappear.

Without the patch, in the first case, the leftmost icons in the Recipe column still give an exception. The second case removes all errors on hover in the example.

shpaass commented 1 month ago

Without the patch, in the first case, the leftmost icons in the Recipe column still give an exception.

With the proposed PR, this error is still present.

DaleStan commented 1 month ago

I can't reproduce your experience. Are you adding the item, the recipe, or the technology to the milestones? The error depends on the item being missing from the milestones.

I see this: image

shpaass commented 1 month ago

Apologies, it was my mistake. I've fetched the PR, but failed to checkout it. The fix works.