]> git.deb.at Git - deb/packages.git/commitdiff
Search.pm: Avoid printing empty items in the similar packages list.
authorNoritada Kobayashi <nori1@dolphin.c.u-tokyo.ac.jp>
Mon, 26 Nov 2007 11:44:18 +0000 (20:44 +0900)
committerNoritada Kobayashi <nori1@dolphin.c.u-tokyo.ac.jp>
Mon, 26 Nov 2007 11:44:18 +0000 (20:44 +0900)
Consider conditions where the number of similar packages are less than
11, avoiding printing "<li><a href="/"></a></li>" in the similar
packages list.

lib/Packages/Search.pm

index 52f451e0a9bf52a20a9d3c0c5cfc800a66f25a0b..04270f2301b9d29caa59e013d30843bb4f097f00 100644 (file)
@@ -282,7 +282,9 @@ sub find_similar {
     undef $db;
 
     debug ("ORDER: @order", 2) if DEBUG;
-    return @order[0..10];
+    my $last = 10;
+    $last = $#order if $#order < $last;
+    return @order[0..$last];
 }
 
 sub find_binaries {