Improved JSON string parsing

This commit is contained in:
Tobias Taschner
2020-01-19 21:32:11 +01:00
parent 26c82d43d1
commit caf9285609
2 changed files with 34 additions and 33 deletions

View File

@@ -811,7 +811,10 @@ bool wxWebViewEdge::RunScript(const wxString& javascript, wxString* output)
if (RunScriptSync(wrapJS.GetUnwrappedOutputCode() + ";", &result))
{
if (output)
*output = wxJSON::DecodeString(result);
// Try to decode JSON string or return original
// result if it's not a valid JSON string
if (!wxJSON::DecodeString(result, output))
*output = result;
result.clear();
}