Skip to content

Commit

Permalink
fix: Fix an issue casting a null Variant.
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzzybinary committed Oct 27, 2024
1 parent 7effaef commit 772485e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/dart/godot_dart/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.6.1

- Fix `Variant.cast` to correctly return null in cases where the Variant is null.

## 0.6.0

- Adjust generate global constats to avoid unnecessary prefixes.
Expand Down
4 changes: 2 additions & 2 deletions src/dart/godot_dart/lib/src/variant/variant.dart
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ class Variant implements Finalizable {
var typeInfo = gde.dartBindings.getGodotTypeInfo(T);
return convertFromVariant(this, typeInfo) as T?;
}
final obj = convertFromVariant(this, GodotObject.sTypeInfo) as GodotObject;
return obj.cast<T>();
final obj = convertFromVariant(this, GodotObject.sTypeInfo) as GodotObject?;
return obj?.cast<T>();
}

void _attachFinalizer() {
Expand Down

0 comments on commit 772485e

Please sign in to comment.