Browse Source

Merge pull request #229 from nuskey8/fix-state-dispose

fix: Disposal of dead coroutine  cause NullReference Exception
akeit0 4 days ago
parent
commit
2027d84bea
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/Lua/LuaState.cs

+ 2 - 1
src/Lua/LuaState.cs

@@ -487,7 +487,8 @@ public class LuaState : IDisposable
 
     public void Dispose()
     {
-        if (CoreData!.CallStack.Count != 0)
+        if(CoreData == null) return;
+        if (CoreData.CallStack.Count != 0)
         {
             throw new InvalidOperationException("This state is running! Call stack is not empty!!");
         }