[News] Check if revision is a string

This commit is contained in:
momo5502 2017-02-12 13:06:54 +01:00
parent aa76d38f3c
commit 358d039244

View File

@ -64,14 +64,17 @@ namespace Components
std::string error;
json11::Json client = json11::Json::parse(_client.data(), error);
std::string revisionString = client["revision"].string_value();
if (!revisionString.empty())
if (client["revision"].is_string())
{
int revision = atoi(revisionString.data());
std::string revisionString = client["revision"].string_value();
Dvar::Var("cl_updateversion").get<Game::dvar_t*>()->current.integer = revision;
Dvar::Var("cl_updateavailable").get<Game::dvar_t*>()->current.boolean = (revision > REVISION);
if (!revisionString.empty())
{
int revision = atoi(revisionString.data());
Dvar::Var("cl_updateversion").get<Game::dvar_t*>()->current.integer = revision;
Dvar::Var("cl_updateavailable").get<Game::dvar_t*>()->current.boolean = (revision > REVISION);
}
}
}
}