summaryrefslogtreecommitdiff
path: root/libs/libjson/src/JSONNode.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-03-25 15:11:34 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-03-25 15:11:34 +0300
commit496b8d54f05de925f7827785544acbaec35fa356 (patch)
treeefddde401d7b52ed2ee54737a700045730e1a71e /libs/libjson/src/JSONNode.cpp
parent27d82200ded3da7e718bfef2cd50ab7ef18050dc (diff)
fixes #3454 (Telegram: crash fix)
Diffstat (limited to 'libs/libjson/src/JSONNode.cpp')
-rw-r--r--libs/libjson/src/JSONNode.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/libs/libjson/src/JSONNode.cpp b/libs/libjson/src/JSONNode.cpp
index 1340254b02..daf6e80e2c 100644
--- a/libs/libjson/src/JSONNode.cpp
+++ b/libs/libjson/src/JSONNode.cpp
@@ -53,9 +53,18 @@ JSONNode nullNode(JSON_NULL);
IMPLEMENT_FOR_ALL_TYPES(IMPLEMENT_CTOR)
#ifndef JSON_LIBRARY
- JSONNode::JSONNode(const json_string & name_t, const json_char * value_t) : internal(internalJSONNode::newInternal()) {
- internal -> Set(json_string(value_t));
- internal -> setname(name_t);
+ JSONNode::JSONNode(const json_string &name_t, const json_char *value_t) : internal(internalJSONNode::newInternal())
+ {
+ internal->Set(json_string(value_t ? value_t : ""));
+ internal->setname(name_t);
+ incAllocCount();
+ }
+
+ JSONNode::JSONNode(const json_string &name_t, const wchar_t *value_t) : internal(internalJSONNode::newInternal())
+ {
+ T2Utf val(value_t);
+ internal->Set(json_string(val ? val : ""));
+ internal->setname(name_t);
incAllocCount();
}
#endif