Skip to content

Commit

Permalink
Merge pull request #92800 from raulsntos/dotnet/fix-check-call-error
Browse files Browse the repository at this point in the history
C#: Skip method name when checking CallError
  • Loading branch information
akien-mga committed Jun 7, 2024
2 parents ea7d988 + 44d4f63 commit 7a5fad8
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public unsafe static void DebugCheckCallError(godot_string_name method, IntPtr i
if (error.Error != godot_variant_call_error_error.GODOT_CALL_ERROR_CALL_OK)
{
using godot_variant instanceVariant = VariantUtils.CreateFromGodotObjectPtr(instance);
string where = GetCallErrorWhere(method, &instanceVariant, args, argCount);
string where = GetCallErrorWhere(ref error, method, &instanceVariant, args, argCount);
string errorText = GetCallErrorMessage(error, where, args);
GD.PushError(errorText);
}
Expand All @@ -161,7 +161,7 @@ public unsafe static void DebugCheckCallError(in godot_callable callable, godot_
}
}

private unsafe static string GetCallErrorWhere(godot_string_name method, godot_variant* instance, godot_variant** args, int argCount)
private unsafe static string GetCallErrorWhere(ref godot_variant_call_error error, godot_string_name method, godot_variant* instance, godot_variant** args, int argCount)
{
string? methodstr = null;
string basestr = GetVariantTypeName(instance);
Expand All @@ -171,6 +171,10 @@ private unsafe static string GetCallErrorWhere(godot_string_name method, godot_v
if (argCount >= 1)
{
methodstr = VariantUtils.ConvertToString(*args[0]);
if (error.Error == godot_variant_call_error_error.GODOT_CALL_ERROR_CALL_ERROR_INVALID_ARGUMENT)
{
error.Argument += 1;
}
}
}

Expand Down

0 comments on commit 7a5fad8

Please sign in to comment.