1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-16 11:33:03 +01:00

Handle no object for context.getObject correctly

This commit is contained in:
Ted John
2020-05-07 19:51:53 +01:00
parent 46d69126ea
commit 21f55eaeeb
2 changed files with 7 additions and 1 deletions

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

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