diff options
author | George Hazan <ghazan@miranda.im> | 2023-03-25 15:11:34 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2023-03-25 15:11:34 +0300 |
commit | 496b8d54f05de925f7827785544acbaec35fa356 (patch) | |
tree | efddde401d7b52ed2ee54737a700045730e1a71e /libs/libjson/src/JSONNode.cpp | |
parent | 27d82200ded3da7e718bfef2cd50ab7ef18050dc (diff) |
fixes #3454 (Telegram: crash fix)
Diffstat (limited to 'libs/libjson/src/JSONNode.cpp')
-rw-r--r-- | libs/libjson/src/JSONNode.cpp | 15 |
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
|