summaryrefslogtreecommitdiff
path: root/libs/libjson/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-09-12 10:27:05 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-09-12 10:27:13 +0300
commit8f010ca870666ea136890d8c6317d0092cbe30ab (patch)
tree5d0fd00db49c87b47eb45b195653363a825cfc4f /libs/libjson/src
parent6762ce55cf24b021c60e9cb9d0229f5550f69ba2 (diff)
another fix for #4643
Diffstat (limited to 'libs/libjson/src')
-rw-r--r--libs/libjson/src/libJSON.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/libs/libjson/src/libJSON.cpp b/libs/libjson/src/libJSON.cpp
index e52af2b6db..bd654fa70d 100644
--- a/libs/libjson/src/libJSON.cpp
+++ b/libs/libjson/src/libJSON.cpp
@@ -338,12 +338,24 @@ LIBJSON_DLL(JSONNode*) json_as_array(const JSONNode *node) {
#ifdef JSON_WRITER
LIBJSON_DLL(wchar_t*) json_write(const JSONNode *node) {
JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_write"), return toCString(EMPTY_CSTRING););
- return toCString(node->write());
+ try {
+ return toCString(node->write());
+ }
+ catch (...) {
+ Netlib_Logf(0, "Exception in writing JSON");
+ }
+ return mir_wstrdup(L"");
}
LIBJSON_DLL(wchar_t*) json_write_formatted(const JSONNode *node) {
JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_write_formatted"), return toCString(EMPTY_CSTRING););
- return toCString(node->write_formatted());
+ try {
+ return toCString(node->write_formatted());
+ }
+ catch (...) {
+ Netlib_Logf(0, "Exception in writing JSON");
+ }
+ return mir_wstrdup(L"");
}
#endif