--- taxonomy_ticker.module.orig	2005-12-25 14:22:42.000000000 +0100
+++ taxonomy_ticker.module	2005-12-25 15:00:11.000000000 +0100
@@ -16,27 +16,24 @@
 }
 
 function taxonomy_ticker_contents() {
-  $block = "
-<div id=\"scrollerClipper\">
-  <div id=\"scrollPane\" style=\"position:relative; top:0px ; left:0px;\" onMouseOver=\"pauseScroll();\" onMouseOut=\"reStartScroll();\">
-";
   $type_q = ($type ? "n.type = '$type'" : 1);
   $tid = variable_get("taxonomy_ticker_tid", 1);
   foreach ($tid as $key => $val) {
     $tid[$key] = "r.tid = '$val'";
   }
-  $query = db_rewrite_sql("SELECT n.nid, n.title, n.type FROM {node} n LEFT JOIN {term_node} r ON r.nid = n.nid WHERE n.status = 1 AND (".join(" OR ", $tid) . ") AND $type_q ORDER BY n.changed DESC");
-  
-  $results = db_query_range($query, 0, variable_get("taxonomy_ticker_count", 5));
+  if (!empty($tid)) $tids = "AND (" . join(" OR ", $tid) . ")";
 
-  while ( $result = db_fetch_object($results) ) {
-    $block .= "<div class=\"scrollerContentItem\"><p>$result->title</p></div>";
+  $query = db_rewrite_sql("SELECT n.nid, n.title, n.type FROM {node} n LEFT JOIN {term_node} r ON r.nid = n.nid WHERE n.status = 1 " . $tids . " AND $type_q ORDER BY n.changed DESC");
+  $results = db_query_range($query, 0, variable_get("taxonomy_ticker_count", 5));
+ 
+  if (db_affected_rows()) {
+    $block = "\n<div id=\"scrollerClipper\">\n  <div id=\"scrollPane\" style=\"position:relative; top:0px ; left:0px;\" onMouseOver=\"pauseScroll();\" onMouseOut=\"reStartScroll();\">\n";
+
+    while ( $result = db_fetch_object($results) ) {
+      $block .= "<div class=\"scrollerContentItem\"><p>$result->title</p></div>";
+    }
+    $block .= "\n  </div>\n</div>\n";
   }
-  $block .= "
-  </div>
-</div>
-";
-
   return $block;
 }
 
