-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationenhancementNew feature or requestNew feature or request
Description
The documentation for JSONObject.FromString states:
@return Object handle, or null on failure
However, in the current version, FromString throws an exception on invalid JSON instead of returning null.
This breaks typical SourcePawn usage like:
JSONObject obj = JSONObject.FromString(message);
if (obj != null)
{
// handle JSON
}
else
{
// fallback if message is not JSON
}
Since SourcePawn has no try/catch mechanism, this makes it impossible to safely parse optional JSON or handle malformed input.
Suggested fixes:
- Restore the old behavior of returning
nullon invalid JSON. - Implement alternatives methods that do not throw.
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationenhancementNew feature or requestNew feature or request