no00ob / LCSoundTool

Simple Lethal Company sound tool and debugger.
MIT License
11 stars 5 forks source link

ArgumentException when reloading a file with the same name #6

Closed Danice123 closed 8 months ago

Danice123 commented 8 months ago

https://github.com/no00ob/LCSoundTool/blob/4e0a3f1593f21ea75cbcd5b2cfc02dcff91ce5f7/SoundTool.cs#L880-L881

If a mod was to reload a file with the same filename, this throws an ArgumentException: An item with the same key has already been added. Key: XYZ

Probably would be more sane to check if this clip is being reloaded and replace the type.

Hypothetical solution

if (result != null) 
-     clipTypes.Add(result.GetName(), audioType);
+     clipTypes[result.GetName()] = audioType;
no00ob commented 8 months ago

Hey! Thanks for letting me know and thank you very much for the fix. I'll merge it into the next update.