Fix newVariant for nil strings and older Nim
This commit is contained in:
parent
19b0c23d62
commit
2f3f4034cf
2 changed files with 5 additions and 1 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
version = "0.7.21"
|
version = "0.7.22"
|
||||||
author = "Xored Software, Inc."
|
author = "Xored Software, Inc."
|
||||||
description = "Godot Engine bindings"
|
description = "Godot Engine bindings"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,10 @@ proc newVariant*(r: cdouble): Variant {.inline.} =
|
||||||
|
|
||||||
proc newVariant*(s: string): Variant {.inline.} =
|
proc newVariant*(s: string): Variant {.inline.} =
|
||||||
new(result, variantFinalizer)
|
new(result, variantFinalizer)
|
||||||
|
when (NimMajor, NimMinor, NimPatch) < (0, 19, 0):
|
||||||
|
if s.isNil:
|
||||||
|
initGodotVariant(result.godotVariant)
|
||||||
|
return
|
||||||
var godotStr = s.toGodotString()
|
var godotStr = s.toGodotString()
|
||||||
initGodotVariant(result.godotVariant, godotStr)
|
initGodotVariant(result.godotVariant, godotStr)
|
||||||
godotStr.deinit()
|
godotStr.deinit()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue