Index: openacs-4/packages/lars-blogger/www/index.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/index.adp,v
diff -u -r1.36 -r1.37
--- openacs-4/packages/lars-blogger/www/index.adp	13 Jan 2005 13:58:22 -0000	1.36
+++ openacs-4/packages/lars-blogger/www/index.adp	1 Mar 2005 12:15:55 -0000	1.37
@@ -58,7 +58,7 @@
           </multiple>
         </div>
       </if>
-      <if @sw_categories:rowcount@ gt 0>
+      <if @sw_cats@ gt 0>
         <div class="lars_blogger_portlet">
          <multiple name="sw_categories">
            <h2>@sw_categories.tree_name@</h2>
Index: openacs-4/packages/lars-blogger/www/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/index.tcl,v
diff -u -r1.26 -r1.27
--- openacs-4/packages/lars-blogger/www/index.tcl	13 Jan 2005 13:58:22 -0000	1.26
+++ openacs-4/packages/lars-blogger/www/index.tcl	1 Mar 2005 12:15:55 -0000	1.27
@@ -179,24 +179,30 @@
     set type "all"
 }
 
-db_multirow -unclobber -extend { sw_category_name tree_name } sw_categories sw_categories {
-    select c.category_id as sw_category_id, c.tree_id
-    from   categories c, category_tree_map ctm
-    where  ctm.tree_id = c.tree_id
-    and    ctm.object_id = :package_id
-} {
-    set sw_category_name [category::get_name $sw_category_id]
-    set tree_name [category_tree::get_name $tree_id]
-}
-
 set counts {}
+set sw_cats 0
 db_foreach catcount {select c.category_id as catid, count(*) as count from category_object_map c, pinds_blog_entries e where e.package_id = :package_id and c.object_id = e.entry_id group by c.category_id} { 
     lappend counts $catid $count
+    if {$count > 0} {
+        incr sw_cats
+    }
 }
 
-set container_id [ad_conn [parameter::get -parameter CategoryContainer -default package_id]]
-category_tree::get_multirow -datasource sw_categories -container_id $container_id -category_counts $counts
+if {$sw_cats} {
+    db_multirow -unclobber -extend { sw_category_name tree_name } sw_categories sw_categories {
+        select c.category_id as sw_category_id, c.tree_id
+        from   categories c, category_tree_map ctm
+        where  ctm.tree_id = c.tree_id
+        and    ctm.object_id = :package_id
+    } {
+        set sw_category_name [category::get_name $sw_category_id]
+        set tree_name [category_tree::get_name $tree_id]
+    }
 
+    set container_id [ad_conn [parameter::get -parameter CategoryContainer -default package_id]]
+    category_tree::get_multirow -datasource sw_categories -container_id $container_id -category_counts $counts
+}
+
 # Cut the URL off the last item in the context bar
 if { [llength $context] > 0 } {
     set context [lreplace $context end end [lindex [lindex $context end] end]]