From 61bc8b0ae15955585af3edbd1fd9d1c615e89301 Mon Sep 17 00:00:00 2001 From: Changgyu Choi Date: Thu, 24 Feb 2022 09:43:09 +0900 Subject: [PATCH] Fix static analysis issue Changes: - Adds checking that the variable is nullptr. Change-Id: I632547066e972cf99d7f2c99b2464b39029e7b24 Signed-off-by: Changgyu Choi --- src/launchpad-parser/launchpad_parser_plugin.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/launchpad-parser/launchpad_parser_plugin.cc b/src/launchpad-parser/launchpad_parser_plugin.cc index 8ccee30..f873673 100644 --- a/src/launchpad-parser/launchpad_parser_plugin.cc +++ b/src/launchpad-parser/launchpad_parser_plugin.cc @@ -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; -- 2.7.4