fix exception when destruction occurs before game has been initialized
All checks were successful
Release / Get Version (push) Successful in 15s
Release / Build and Publish Nuget (push) Successful in 2m21s
Release / Build and Publish Package (push) Successful in 2m51s

This commit is contained in:
zznty
2024-10-13 22:29:05 +07:00
parent 6a695f2abf
commit 65e2f342a3

View File

@@ -312,7 +312,7 @@ namespace Torch
private void Destroy() private void Destroy()
{ {
_game.Dispose(); _game?.Dispose();
_game = null; _game = null;
MyGameService.ShutDown(); MyGameService.ShutDown();
@@ -462,6 +462,7 @@ namespace Torch
public void SignalDestroy() public void SignalDestroy()
{ {
_destroyGame = true; _destroyGame = true;
if (_game is not null)
SignalStop(); SignalStop();
_commandChanged.Set(); _commandChanged.Set();
} }