Fix static analysis issue 30/271630/2
authorChanggyu Choi <changyu.choi@samsung.com>
Thu, 24 Feb 2022 00:43:09 +0000 (09:43 +0900)
committerChanggyu Choi <changyu.choi@samsung.com>
Thu, 24 Feb 2022 00:45:15 +0000 (00:45 +0000)
Changes:
 - Adds checking that the variable is nullptr.

Change-Id: I632547066e972cf99d7f2c99b2464b39029e7b24
Signed-off-by: Changgyu Choi <changyu.choi@samsung.com>
src/launchpad-parser/launchpad_parser_plugin.cc

index 8ccee30..f873673 100644 (file)
@@ -142,6 +142,9 @@ int LaunchpadParser::Upgrade(xmlDocPtr doc, std::string pkgid) {
 
 int LaunchpadParser::UnInstall(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;