Handle no object for context.getObject correctly

This commit is contained in:
Ted John committed 2020-05-08 15:28:48 +01:00
1 parent 46d69126ea
commit 21f55eaeeb
2 files changed
+7 -1

No files matched your search

+6
View File
@@ -193,6 +193,12 @@ namespace OpenRCT2::Scripting
template<typename T> DukValue ToDuk(duk_context* ctx, const T& value) = delete;
template<typename T> 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
+1 -1
View File
@@ -82,7 +82,7 @@ namespace OpenRCT2::Scripting
{
duk_error(ctx, DUK_ERR_ERROR, "Invalid object type.");
}
return {};
return ToDuk(ctx, nullptr);
}
std::vector<DukValue> getAllObjects(const std::string& typez) const