summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2019-07-21 12:57:42 +0200
committerRicardo Wurmus <rekado@elephly.net>2019-07-21 12:57:42 +0200
commitfb0ae064037a38a0d526e08b4ad24c52e205edb9 (patch)
treee4a42d03fec3415addd79c923ed14aac74f9f634
parent8ecba04cd14e9e56d4a67e76ae88f35022f20d48 (diff)
operations: get-bug-message-numbers: Check index before using it.
* debbugs/operations.scm (get-bug-message-numbers)<drop-lines>: Return unmodified string if there are no lines to drop.
-rw-r--r--debbugs/operations.scm7
1 files 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