]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
xgettext, xlocator: Fix minor issues
authorDaiki Ueno <ueno@gnu.org>
Fri, 25 Sep 2015 08:09:14 +0000 (17:09 +0900)
committerDaiki Ueno <ueno@gnu.org>
Fri, 25 Sep 2015 08:09:14 +0000 (17:09 +0900)
gettext-tools/src/xgettext.c
gettext-tools/src/xlocator.c

index 9ad4c5b799c0b26064570b9ff77170bbc4eff23f..a26a854788bf13315693e2b733779154399fdf2d 100644 (file)
@@ -970,7 +970,8 @@ warning: file '%s' extension '%s' is unknown; will try C"), filename, extension)
   /* Write the PO file.  */
   msgdomain_list_print (mdlp, file_name, output_syntax, force_po, do_debug);
 
-  xlocator_list_free (its_locators);
+  if (its_locators)
+    xlocator_list_free (its_locators);
 
   exit (EXIT_SUCCESS);
 }
index 44e2a1758be613c8f425b4e8a750ca21207decd6..474b0772f3566ce079fde0edbc90eb59e2ae98a8 100644 (file)
@@ -142,10 +142,12 @@ xlocator_match (struct xlocator_ty *locator, const char *path,
 
           root = xmlDocGetRootElement (doc);
           if (locator->type == XLOCATOR_NAMESPACE)
-            result = xmlStrEqual (root->ns->href, BAD_CAST locator->matcher.ns);
+            result = root->ns != NULL
+              && xmlStrEqual (root->ns->href, BAD_CAST locator->matcher.ns);
           else
             result =
               ((!locator->matcher.d.prefix
+                || *locator->matcher.d.prefix == '\0'
                 || !root->ns
                 || xmlStrEqual (root->ns->prefix,
                                 BAD_CAST locator->matcher.d.prefix))
@@ -358,6 +360,7 @@ xlocator_list_add_file (struct xlocator_list_ty *locators,
 
   root = xmlDocGetRootElement (doc);
   if (!(xmlStrEqual (root->name, BAD_CAST "locatingRules")
+        && root->ns
         && xmlStrEqual (root->ns->href, BAD_CAST LOCATING_RULES_NS)))
     {
       error (0, 0, _("the root element is not \"locatingRules\""