From fb0ae064037a38a0d526e08b4ad24c52e205edb9 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Sun, 21 Jul 2019 12:57:42 +0200 Subject: operations: get-bug-message-numbers: Check index before using it. * debbugs/operations.scm (get-bug-message-numbers): Return unmodified string if there are no lines to drop. --- debbugs/operations.scm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/debbugs/operations.scm b/debbugs/operations.scm index e459a9d..d744ac4 100644 --- a/debbugs/operations.scm +++ b/debbugs/operations.scm @@ -151,8 +151,11 @@ bug identified by BUG-ID." (define (drop-lines str k) (if (zero? k) str - (drop-lines (substring str (1+ (string-index str #\newline))) - (1- k)))) + (or (and=> (string-index str #\newline) + (lambda (index) + (drop-lines (substring str (1+ index)) + (1- k)))) + str))) (let ((msg-nums ((sxpath '(// urn:Debbugs/SOAP:get_bug_logResponse http://schemas.xmlsoap.org/soap/encoding/:Array -- cgit v1.2.3