From cabdab13f24d430112b227d6c3feb7a6548fb74e Mon Sep 17 00:00:00 2001 From: "Nuno.Esculcas" Date: Thu, 22 Oct 2020 21:16:58 +0100 Subject: Fix appendToJson function when value is a const char* --- include/tgbot/TgTypeParser.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include') 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; -- cgit v1.2.3