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:
@@ -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