mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-17 20:13:07 +01:00
Ensure all paths return a value regardless of duk_error
This commit is contained in:
@@ -132,6 +132,7 @@ namespace OpenRCT2::Scripting
|
||||
|
||||
DukValue getAll(const std::string& ns)
|
||||
{
|
||||
DukValue result;
|
||||
auto ctx = GetContext()->GetScriptEngine().GetContext();
|
||||
if (IsValidNamespace(ns))
|
||||
{
|
||||
@@ -142,18 +143,19 @@ namespace OpenRCT2::Scripting
|
||||
{
|
||||
obj.Set("general.showFps", gConfigGeneral.show_fps);
|
||||
}
|
||||
return obj.Take();
|
||||
result = obj.Take();
|
||||
}
|
||||
else
|
||||
{
|
||||
auto obj = GetNamespaceObject(ns);
|
||||
return obj ? *obj : DukObject(ctx).Take();
|
||||
result = obj ? *obj : DukObject(ctx).Take();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
duk_error(ctx, DUK_ERR_ERROR, "Namespace was invalid.");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
DukValue get(const std::string& key, const DukValue& defaultValue)
|
||||
|
||||
Reference in New Issue
Block a user