forked from rosebudai/OpenRCT2-Web
Handle no object for context.getObject correctly
This commit is contained in:
1 parent
46d69126ea
commit
21f55eaeeb
2 files changed
+7
-1
No files matched your search
@@ -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
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user