Fix static analysis issue 35/299035/1
authorHwankyu Jhun <h.jhun@samsung.com>
Mon, 18 Sep 2023 22:20:25 +0000 (07:20 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Mon, 18 Sep 2023 22:20:25 +0000 (07:20 +0900)
Checker:
 - DEREF_OF_NULL.RET_STAT

Change-Id: Ifc95e098d24ccd2d80c83bee5f3340b4e13c5a66
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/launchpad-parser/launchpad_parser_plugin.cc

index eacfbf2..575afd6 100644 (file)
@@ -94,6 +94,9 @@ int LaunchpadParser::Install(xmlDocPtr doc, std::string pkgid) {
   }
 
   xmlNode* root = xmlDocGetRootElement(doc);
+  if (root == nullptr)
+    return -1;
+
   for (xmlNode* node = root->children; node; node = node->next) {
     if (!node->name)
       continue;