Skip to content

Commit 5962d25

Browse files
committed
fix: Fix an issue casting a null Variant.
1 parent 7effaef commit 5962d25

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

src/dart/godot_dart/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.6.1
2+
3+
- Fix `Variant.cast` to correctly return null in cases where the Variant is null.
4+
15
## 0.6.0
26

37
- Adjust generate global constats to avoid unnecessary prefixes.

src/dart/godot_dart/lib/src/variant/variant.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,8 @@ class Variant implements Finalizable {
197197
var typeInfo = gde.dartBindings.getGodotTypeInfo(T);
198198
return convertFromVariant(this, typeInfo) as T?;
199199
}
200-
final obj = convertFromVariant(this, GodotObject.sTypeInfo) as GodotObject;
201-
return obj.cast<T>();
200+
final obj = convertFromVariant(this, GodotObject.sTypeInfo) as GodotObject?;
201+
return obj?.cast<T>();
202202
}
203203

204204
void _attachFinalizer() {

src/dart/godot_dart/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: godot_dart
22
description: Dart bindings for the Godot game engine
33
repository: https://github.com/fuzzybinary/godot_dart
4-
version: 0.6.0
4+
version: 0.6.1
55

66
environment:
77
sdk: '>=3.2.0 <4.0.0'

0 commit comments

Comments
 (0)