pkgmgr doesn't give the docPtr anymore while uninstalling. 89/12389/1
authorSung-jae Park <nicesj.park@samsung.com>
Thu, 14 Nov 2013 09:52:36 +0000 (18:52 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Thu, 14 Nov 2013 09:52:36 +0000 (18:52 +0900)
While uninstalling a package, pkgmgr doesn't give the docPtr anymore.
So the plugin cannot parse the document anymore.
Now the plugin should validate the docPtr before try to parse it.
If the docPtr is NULL, skip to parse a document for safety.

Change-Id: Idaa6841e9c6068662d57832f4be99e1a3a9236f6

pkgmgr_shortcut/src/service_register.c

index 83864ef..56822d3 100644 (file)
@@ -386,7 +386,6 @@ static void do_upgrade_db_schema(void)
        }
 }
 
-
 static int db_remove_record(const char *pkgid, const char *appid, const char *key, const char *data)
 {
        static const char *dml = "DELETE FROM shortcut_service WHERE appid = ? AND extra_key = ? AND extra_data = ? AND pkgid = ?";
@@ -969,6 +968,11 @@ int PKGMGR_PARSER_PLUGIN_UNINSTALL(xmlDocPtr docPtr, const char *_appid)
        xmlNodePtr root;
        int id;
 
+       if (!docPtr) {
+               DbgPrint("Package manager doesn't support the docPtr (%s)\n", _appid);
+               return 0;
+       }
+
        root = xmlDocGetRootElement(docPtr);
        if (!root) {
                ErrPrint("Invalid node ptr\n");