summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/libjson/src/internalJSONNode.cpp3
-rw-r--r--libs/libjson/src/internalJSONNode.h4
-rw-r--r--protocols/Discord/src/utils.cpp5
3 files changed, 9 insertions, 3 deletions
diff --git a/libs/libjson/src/internalJSONNode.cpp b/libs/libjson/src/internalJSONNode.cpp
index 411c12582e..38ca24ff29 100644
--- a/libs/libjson/src/internalJSONNode.cpp
+++ b/libs/libjson/src/internalJSONNode.cpp
@@ -38,7 +38,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
static const json_string CONST_TRUE(JSON_TEXT("true"));
static const json_string CONST_FALSE(JSON_TEXT("false"));
-static const json_string CONST_NULL(JSON_TEXT("null"));
#ifdef JSON_UNIT_TEST
void internalJSONNode::incinternalAllocCount(void){ JSONNode::incinternalAllocCount(); }
@@ -344,7 +343,7 @@ void internalJSONNode::Nullify(bool validation) const {
void internalJSONNode::Nullify(void) const {
#endif
_type = JSON_NULL;
- _string = CONST_NULL;
+ _string.clear();
SetFetched(true);
}
diff --git a/libs/libjson/src/internalJSONNode.h b/libs/libjson/src/internalJSONNode.h
index c77e502543..26e279764e 100644
--- a/libs/libjson/src/internalJSONNode.h
+++ b/libs/libjson/src/internalJSONNode.h
@@ -285,11 +285,15 @@ inline void internalJSONNode::setname(const json_string & newname){
inline json_string internalJSONNode::as_string(void) const {
Fetch();
+ if (_type == JSON_NULL)
+ return json_string();
return _string;
}
inline CMStringW internalJSONNode::as_mstring(void) const {
Fetch();
+ if (_type == JSON_NULL)
+ return CMStringW();
return CMStringW(ptrW(mir_utf8decodeW(_string.c_str())));
}
diff --git a/protocols/Discord/src/utils.cpp b/protocols/Discord/src/utils.cpp
index a9b95b6f49..daddcc46ff 100644
--- a/protocols/Discord/src/utils.cpp
+++ b/protocols/Discord/src/utils.cpp
@@ -197,7 +197,10 @@ CDiscordUser* CDiscordProto::PrepareUser(const JSONNode &user)
pUser->hContact = hContact;
}
- setWString(pUser->hContact, DB_KEY_AVHASH, avatar);
+ if (avatar.IsEmpty())
+ delSetting(pUser->hContact, DB_KEY_AVHASH);
+ else
+ setWString(pUser->hContact, DB_KEY_AVHASH, avatar);
return pUser;
}