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 5962d25
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 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
2 changes: 1 addition & 1 deletion src/dart/godot_dart/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: godot_dart
description: Dart bindings for the Godot game engine
repository: https://github.com/fuzzybinary/godot_dart
version: 0.6.0
version: 0.6.1

environment:
sdk: '>=3.2.0 <4.0.0'
Expand Down

0 comments on commit 5962d25

Please sign in to comment.