fix crash if a cs mod errors in the dispose method

This commit is contained in:
Evil Factory
2022-07-07 09:52:29 -03:00
parent bf0ea54cdd
commit e73cd0f398
2 changed files with 17 additions and 4 deletions
@@ -29,8 +29,17 @@ namespace Barotrauma
LoadedMods.Add(this);
}
public void Dispose() {
Stop();
public void Dispose()
{
try
{
Stop();
}
catch (Exception e)
{
GameMain.LuaCs.HandleException(e, null, LuaCsSetup.ExceptionType.CSharp);
}
LoadedMods.Remove(this);
IsDisposed = true;
}