summaryrefslogtreecommitdiff
path: root/cut-n-paste
diff options
context:
space:
mode:
authorlvtao-sec <[email protected]>2020-08-22 18:50:00 +0800
committerraveit65 <[email protected]>2020-08-26 13:35:49 +0200
commit9f86b203c1a411dd24b3219c104db16b6ecedc95 (patch)
tree9ef7eb6e06b7bfe67438ddfe5350bae41f51ef09 /cut-n-paste
parent03693b12f9d76bc16c02d5ac6ff42ad51c7316fa (diff)
downloadatril-9f86b203c1a411dd24b3219c104db16b6ecedc95.tar.bz2
atril-9f86b203c1a411dd24b3219c104db16b6ecedc95.tar.xz
check return value of xmlDocGetRootElement call if is NULL
Diffstat (limited to 'cut-n-paste')
-rw-r--r--cut-n-paste/toolbar-editor/egg-toolbars-model.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/cut-n-paste/toolbar-editor/egg-toolbars-model.c b/cut-n-paste/toolbar-editor/egg-toolbars-model.c
index 94cc7fd3..f3cc8022 100644
--- a/cut-n-paste/toolbar-editor/egg-toolbars-model.c
+++ b/cut-n-paste/toolbar-editor/egg-toolbars-model.c
@@ -597,7 +597,12 @@ egg_toolbars_model_load_toolbars (EggToolbarsModel *model,
return FALSE;
}
root = xmlDocGetRootElement (doc);
-
+ if (root == NULL)
+ {
+ g_warning ("Failed to get root element");
+ xmlFreeDoc (doc);
+ return FALSE;
+ }
parse_toolbars (model, root->children);
xmlFreeDoc (doc);
@@ -627,6 +632,8 @@ egg_toolbars_model_load_toolbars_from_resource (EggToolbarsModel *model,
g_error ("Failed to load XML data from resource %s", path);
root = xmlDocGetRootElement (doc);
+ if (root == NULL)
+ g_error ("Failed to get root element");
parse_toolbars (model, root->children);
xmlFreeDoc (doc);
@@ -691,6 +698,12 @@ egg_toolbars_model_load_names (EggToolbarsModel *model,
return FALSE;
}
root = xmlDocGetRootElement (doc);
+ if (root == NULL)
+ {
+ g_warning ("Failed to get root element");
+ xmlFreeDoc (doc);
+ return FALSE;
+ }
parse_names (model, root->children);
@@ -721,6 +734,8 @@ egg_toolbars_model_load_names_from_resource (EggToolbarsModel *model,
g_error ("Failed to load XML data from resource %s", path);
root = xmlDocGetRootElement (doc);
+ if (root == NULL)
+ g_error ("Failed to get root element");
parse_names (model, root->children);
xmlFreeDoc (doc);