diff --git a/src/openrct2/scripting/Duktape.hpp b/src/openrct2/scripting/Duktape.hpp index fe47adf8d1..54f26c8eee 100644 --- a/src/openrct2/scripting/Duktape.hpp +++ b/src/openrct2/scripting/Duktape.hpp @@ -193,6 +193,12 @@ namespace OpenRCT2::Scripting template DukValue ToDuk(duk_context* ctx, const T& value) = delete; template T FromDuk(const DukValue& s) = delete; + template<> inline DukValue ToDuk(duk_context* ctx, const std::nullptr_t&) + { + duk_push_null(ctx); + return DukValue::take_from_stack(ctx); + } + } // namespace OpenRCT2::Scripting #endif diff --git a/src/openrct2/scripting/ScContext.hpp b/src/openrct2/scripting/ScContext.hpp index 5b1e1d9878..2d6c17ac1d 100644 --- a/src/openrct2/scripting/ScContext.hpp +++ b/src/openrct2/scripting/ScContext.hpp @@ -82,7 +82,7 @@ namespace OpenRCT2::Scripting { duk_error(ctx, DUK_ERR_ERROR, "Invalid object type."); } - return {}; + return ToDuk(ctx, nullptr); } std::vector getAllObjects(const std::string& typez) const