# This patch file was generated by NetBeans IDE
# This patch can be applied using context Tools: Apply Diff Patch action on respective folder.
# It uses platform neutral UTF-8 encoding.
# Above lines and this line are ignored by the patching process.
Index: includes/theme.inc
--- includes/theme.inc Base (1.421)
+++ includes/theme.inc Locally Modified (Based On 1.421)
@@ -1080,20 +1080,18 @@
  * @param $links
  *   A keyed array of links to be themed.
  * @param $attributes
- *   A keyed array of attributes
+ *   A keyed array of attributes.
  * @return
  *   A string containing an unordered list of links.
  */
 function theme_links($links, $attributes = array('class' => 'links')) {
-  $output = '';
 
-  if (count($links) > 0) {
-    $output = '<ul' . drupal_attributes($attributes) . '>';
+  if (($num_links = count($links)) > 0) {
+    $items = array();
 
-    $num_links = count($links);
-    $i = 1;
-
+    $i = 0;
     foreach ($links as $key => $link) {
+      $i++;
       $class = $key;
 
       // Add first, last and active classes to the list of links to help out themers.
@@ -1106,11 +1104,10 @@
       if (isset($link['href']) && ($link['href'] == $_GET['q'] || ($link['href'] == '<front>' && drupal_is_front_page()))) {
         $class .= ' active';
       }
-      $output .= '<li class="' . $class . '">';
 
       if (isset($link['href'])) {
         // Pass in $link as $options, they share the same keys.
-        $output .= l($link['title'], $link['href'], $link);
+        $contents = l($link['title'], $link['href'], $link);
       }
       else if (!empty($link['title'])) {
         // Some links are actually not links, but we wrap these in <span> for adding title and class attributes
@@ -1121,17 +1118,16 @@
         if (isset($link['attributes'])) {
           $span_attributes = drupal_attributes($link['attributes']);
         }
-        $output .= '<span' . $span_attributes . '>' . $link['title'] . '</span>';
+        $contents = '<span' . $span_attributes . '>' . $link['title'] . '</span>';
       }
+      else continue; // $contents = '';
 
-      $i++;
-      $output .= "</li>\n";
+      $items[] = '<li class="' . $class . '">' . $contents . '</li>';
     }
 
-    $output .= '</ul>';
+    return '<ul' . drupal_attributes($attributes) . ">\n" . implode("\n", $items) . '</ul>';
   }
-
-  return $output;
+//  return '';
 }
 
 /**
