diff options
author | Nuno.Esculcas <nuno.esculcas@gmail.com> | 2020-10-22 21:16:58 +0100 |
---|---|---|
committer | Nuno.Esculcas <nuno.esculcas@gmail.com> | 2020-10-22 21:16:58 +0100 |
commit | cabdab13f24d430112b227d6c3feb7a6548fb74e (patch) | |
tree | ef7262ea1fc81561827dcb503abadf44ee4fb01b /include | |
parent | 9fe48a3628b58dc259c36a106630d8134d029da5 (diff) |
Fix appendToJson function when value is a const char*
Diffstat (limited to 'include')
-rw-r--r-- | include/tgbot/TgTypeParser.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/tgbot/TgTypeParser.h b/include/tgbot/TgTypeParser.h index 6670753..45650c7 100644 --- a/include/tgbot/TgTypeParser.h +++ b/include/tgbot/TgTypeParser.h @@ -494,6 +494,13 @@ private: json += ','; } + inline void appendToJson(std::string& json, const std::string& varName, const char* value) const { + if(value!=nullptr){ + std::string strvalue(value); + appendToJson(json,varName,strvalue); + } + } + inline void appendToJson(std::string& json, const std::string& varName, const char *value) const { appendToJson(json, varName, std::string(value)); } void appendToJson(std::string& json, const std::string& varName, const std::string& value) const; |