recent-bugs: Avoid out of bounds error.
authorRicardo Wurmus <rekado@elephly.net>
Mon, 3 Sep 2018 14:01:57 +0000 (16:01 +0200)
committerRicardo Wurmus <rekado@elephly.net>
Mon, 3 Sep 2018 14:01:57 +0000 (16:01 +0200)
mumi/messages.scm

index 5110de9285a7069e9c526366970ebea569e94a4e..5a14f6af4482a3f51b4df7708ab4b4e7b237614f 100644 (file)
@@ -325,10 +325,11 @@ of message parts."
                                             (one-month
                                              (make-time time-duration 0 (* 60 60 24 30))))
                                         (time-second (subtract-duration this-hour one-month)))))))
-         (ids (take (delete-duplicates
-                     (filter-map (lambda (item)
-                                   (assoc-ref item "id"))
-                                 matches)) amount)))
+         (unique (delete-duplicates
+                  (filter-map (lambda (item)
+                                (assoc-ref item "id"))
+                              matches)))
+         (ids (take unique (min amount (length unique)))))
     (soap-invoke* (%config 'debbugs) get-status ids)))
 
 (define (ago unit amount)