Skip to content

Commit

Permalink
Fix null reference in AddCommandHandlerCallable when callabe does not…
Browse files Browse the repository at this point in the history
… return an object (#80)
  • Loading branch information
meybax authored Jan 24, 2025
1 parent dc5b955 commit 30a8174
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion addons/YarnSpinner-Godot/Runtime/DialogueRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,8 @@ async Task GenerateCommandHandler(params Variant[] handlerArgs)
var castArgs = CastToExpectedTypes(argTypes, commandName, handlerArgs);

var current = handler.Call(castArgs.ToArray());
if (current.As<GodotObject>().GetClass() == "GDScriptFunctionState")
var currentGodotObject = current.As<GodotObject>();
if (currentGodotObject != null && currentGodotObject.GetClass() == "GDScriptFunctionState")
{
// callable is from GDScript with await statements
await ((SceneTree) Engine.GetMainLoop()).ToSignal(current.AsGodotObject(), "completed");
Expand Down

0 comments on commit 30a8174

Please sign in to comment.