Check return value of json parser API
authorYunchan Cho <yunchan.cho@samsung.com>
Fri, 27 Sep 2013 06:34:24 +0000 (15:34 +0900)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Tue, 1 Oct 2013 07:47:55 +0000 (07:47 +0000)
[Issue#]   N/A
[Problem]  return value of the parser API has not been checked
[Cause]    N/A
[Solution] return value of json parser API is checked explicitly.
           if the value is FALSE, remaining code is not executed.

Change-Id: I10754e52f5cbf7d73493e27e61b4a27273fa9581

src/API/web_provider_plugin_info.cpp

index 7dea665..98f2f03 100755 (executable)
@@ -182,8 +182,7 @@ static web_provider_plugin_info* get_parsed_json_data(std::string& configPath)
     JsonParser* parser = json_parser_new();
     GError* error = NULL;
 
-    json_parser_load_from_file(parser, configPath.c_str(), &error);
-    if (error) {
+    if (!json_parser_load_from_file(parser, configPath.c_str(), &error)) {
         LogD("failed to parse json file: %s -> %s", configPath.c_str(), error->message);
         g_error_free(error);
         g_object_unref(parser);