Added a nice error message when JSON structure is invalid

This commit is contained in:
PaulCombal 2019-02-23 23:38:12 +01:00
parent 289cc7884f
commit ba28afb8fb

View File

@ -128,6 +128,11 @@ SteamAppDAO::parse_app_names_v2() {
/* Save the result */
const char * path[] = { "applist", "apps" };
yajl_val v = yajl_tree_get(node, path, yajl_t_array);
if (v == NULL) {
std::cerr << "app_names contains valid JSON, but it's format is not supported" << std::endl;
exit(EXIT_FAILURE);
}
unsigned array_length = v->u.array.len;
unsigned long tmp_appid;
std::string tmp_appname;