CalculateStoredExplosiveDamage throwing KeyNotFoundException

BDCarrillo shared this bug 48 days ago
Reported

As reported on the MES Discord by Nathorus. Snippet of error attached.


Seems that within CalculateStoredExplosiveDamage there is a call that may return this error:

myAmmoDefinition = MyDefinitionManager.Static.GetAmmoDefinition(myAmmoMagazineDefinition.AmmoDefinitionId);


which is:


public MyAmmoDefinition GetAmmoDefinition(MyDefinitionId id)
{
	return m_definitions.m_ammoDefinitionsById[id];
}
That collection is defined as a DefinitionDictionary, a custom class that is a Dictionary<MyDefinitionId, V> where V : MyDefinitionBase
DefinitionDictionary<MyAmmoDefinition> m_ammoDefinitionsById

If the Key, id, is not in the dictionary it seems the logged exception will be thrown. I'm reaching out to some modders who need to make these updates, but I'm sure there's a lot out there that aren't known.

Replies (1)

photo
1

Hello engineer,

Thank you for reaching our forum and letting us know about this issue.

We have put it into our internal system.

Kind Regards,

Keen Software House: QA Department

Leave a Comment
 
Attach a file