Skip to content

Commit

Permalink
Json::Value exception on empty body :/ (fix not tested)
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanoBelli committed Mar 28, 2018
1 parent 724366b commit 3f73481
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,12 @@ int tgbot::methods::Api::getUpdates(void *c,
Json::Value rootUpdate;
Json::Reader parser;

parser.parse(utils::http::get(c, updatesRequest.str()), rootUpdate);
const std::string& responseBody { utils::http::get(c, updatesRequest.str()) };

if(!responseBody.size())
return 0;

parser.parse(responseBody, rootUpdate);

if (!rootUpdate.get("ok", "").asBool()) {
const std::string description(rootUpdate.get("description","").asCString());
Expand Down

0 comments on commit 3f73481

Please sign in to comment.