summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorOleg Morozenkov <m@oleg.rocks>2020-11-10 19:01:16 +0300
committerGitHub <noreply@github.com>2020-11-10 19:01:16 +0300
commitbd70cd3c5206d7c10092f8abb0d07d653b8ce14c (patch)
tree6bd3f5f029820e6b7ee8ec3a0a8a513b829ece68 /include
parenta0839c87262c9e7045407990161c1797e83ceaab (diff)
parente9d4ed341ff9ffcda267e7ecc1541f7ee1e570ed (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.h8
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;
};