]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
only loop through the list if there's a list
authorEvan Prodromou <evan@dev.controlezvous.ca>
Wed, 16 Jul 2008 00:44:14 +0000 (20:44 -0400)
committerEvan Prodromou <evan@dev.controlezvous.ca>
Wed, 16 Jul 2008 00:44:14 +0000 (20:44 -0400)
darcs-hash:20080716004414-d018c-dad819f8c5881271f494dd27a073baa05bb7e7bc.gz

sitemap.php

index 538646a7eff4d27a1f325baa4c944d69d6f46dc4..41d22771139f713eaa08f3084c28ae2dad671c79 100644 (file)
@@ -291,11 +291,13 @@ function urlset($urlset_text) {
 function array_to_map($url_list, $filename_prefix) {
        global $output_paths;
 
-       # $map_urls is a long string containing concatenated <url></url> elements.
-       while (list($map_idx, $map_urls) = each($url_list)) {
-               $urlset_path = $output_paths['output_dir'] . "$filename_prefix-$map_idx.xml";
-
-               write_file($urlset_path, urlset($map_urls));
+       if ($url_list) {
+               # $map_urls is a long string containing concatenated <url></url> elements.
+               while (list($map_idx, $map_urls) = each($url_list)) {
+                       $urlset_path = $output_paths['output_dir'] . "$filename_prefix-$map_idx.xml";
+                       
+                       write_file($urlset_path, urlset($map_urls));
+               }
        }
 }