diff options
author | Oleg Morozenkov <m@oleg.rocks> | 2020-11-10 19:01:16 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-10 19:01:16 +0300 |
commit | bd70cd3c5206d7c10092f8abb0d07d653b8ce14c (patch) | |
tree | 6bd3f5f029820e6b7ee8ec3a0a8a513b829ece68 /include | |
parent | a0839c87262c9e7045407990161c1797e83ceaab (diff) | |
parent | e9d4ed341ff9ffcda267e7ecc1541f7ee1e570ed (diff) |
Merge pull request #154 from nesc1/appendToJsonFix
Fix appendToJson function when value is a const char*
Diffstat (limited to 'include')
-rw-r--r-- | include/tgbot/TgTypeParser.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/include/tgbot/TgTypeParser.h b/include/tgbot/TgTypeParser.h index 6670753..5961bbe 100644 --- a/include/tgbot/TgTypeParser.h +++ b/include/tgbot/TgTypeParser.h @@ -494,7 +494,13 @@ private: json += ','; } - inline void appendToJson(std::string& json, const std::string& varName, const char *value) const { appendToJson(json, varName, std::string(value)); } + 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); + } + } + void appendToJson(std::string& json, const std::string& varName, const std::string& value) const; }; |