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
|
|
@ -73,6 +73,10 @@ proc newVariant*(r: cdouble): Variant {.inline.} =
|
|||
|
||||
proc newVariant*(s: string): Variant {.inline.} =
|
||||
new(result, variantFinalizer)
|
||||
when (NimMajor, NimMinor, NimPatch) < (0, 19, 0):
|
||||
if s.isNil:
|
||||
initGodotVariant(result.godotVariant)
|
||||
return
|
||||
var godotStr = s.toGodotString()
|
||||
initGodotVariant(result.godotVariant, godotStr)
|
||||
godotStr.deinit()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue