mGBA - fix NRE that can happen when rebooting core, fixes #1915

This commit is contained in:
adelikat 2020-04-09 18:36:25 -05:00
parent 05b39a0ec8
commit 04cd7d867c
1 changed files with 8 additions and 5 deletions

View File

@ -65,13 +65,16 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
public void Remove(MemoryCallbackDelegate action)
{
var cbToRemove = _callbacks.Single(container => container.Callback.Callback == action);
var cbToRemove = _callbacks.SingleOrDefault(container => container.Callback.Callback == action);
if (cbToRemove != null)
{
if (LibmGBA.BizClearWatchpoint(_mgba.Core, cbToRemove.ID))
{
_callbacks.Remove(cbToRemove);
}
}
}
public void RemoveAll(IEnumerable<MemoryCallbackDelegate> actions)
{