From c00d1f223660e7f04f7550be521a610849367696 Mon Sep 17 00:00:00 2001 From: Twan van Laarhoven Date: Mon, 4 May 2020 19:58:12 +0200 Subject: [PATCH] Use script_nil instead of creating ScriptObjects with null pointers. Fixes #18 --- src/script/to_value.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/script/to_value.hpp b/src/script/to_value.hpp index 82163aca..6915a2b2 100644 --- a/src/script/to_value.hpp +++ b/src/script/to_value.hpp @@ -408,7 +408,11 @@ inline ScriptValueP to_script(const IndexMap* v) { } template inline ScriptValueP to_script(const intrusive_ptr& v) { - return make_intrusive>>(v); + if (v) { + return make_intrusive>>(v); + } else { + return script_nil; + } } template inline ScriptValueP to_script(const Defaultable& v) {