getString: check if null before casting

This commit is contained in:
DarthArgus
2016-09-26 06:24:21 +00:00
parent dd9417642c
commit 17265362de
+1 -1
View File
@@ -52,7 +52,7 @@ bool webAPI::setData(std::string &data)
std::string webAPI::getString(const std::string &slot)
{
if (!this->responseData.empty() && !slot.empty() && responseData.count(slot))
if (!this->responseData.empty() && !slot.empty() && responseData.count(slot) && !this->responseData[slot].is_null())
{
return this->responseData[slot].get<std::string>();
}