Sign in to follow this  

ModUtil code typo issue


Cairath
  • Branch: Live Branch Version: Windows Fixed

Hey,

I've had some time to figure out why I could no longer add new buildings to the Base category after migrating to use the recently added ModUtils

public static void AddBuildingToPlanScreen(HashedString category, string building_id)
  {
    int index = BUILDINGS.PLANORDER.FindIndex((Predicate<PlanScreen.PlanInfo>) (x => x.category == category));
    if (index <= 0)
      return;
    (BUILDINGS.PLANORDER[index].data as IList<string>).Add(building_id);
  }

FindIndex returns -1 when not found, "Base" building category has index 0, therefore any attempt to add to that building category results in a crash upon research completion of tech with the given building:

KeyNotFoundException: The given key was not present in the dictionary.

I've gone around it, but someone else might get stuck on it.

Cheers!


Steps to Reproduce
Crash upon research completion of tech with a modded building added to the 'Base' category

Status: Fixed

This issue has been fixed in either a future version or updated in a previous version.


  Report Bug
Sign in to follow this  


User Feedback


A developer has marked this issue as fixed. This means that the issue has been addressed in the current development build and will likely be in the next update.
....


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now