[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
175/197: gurses: Don't crash if asked for an item by an invalid index.
From: |
Danny Milosavljevic |
Subject: |
175/197: gurses: Don't crash if asked for an item by an invalid index. |
Date: |
Mon, 3 Jul 2017 20:37:20 -0400 (EDT) |
dannym pushed a commit to branch wip-installer-2
in repository guix.
commit 300f5cfeee06fe6fcf63ac752feab996dc412680
Author: John Darrington <address@hidden>
Date: Tue Feb 7 12:10:13 2017 +0100
gurses: Don't crash if asked for an item by an invalid index.
* gurses/menu.scm (menu-get-current-item): Return #f if the index is
out of range.
---
gurses/menu.scm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/gurses/menu.scm b/gurses/menu.scm
index d1d7954..36f5b42 100644
--- a/gurses/menu.scm
+++ b/gurses/menu.scm
@@ -64,7 +64,9 @@
(define (menu-get-current-item menu)
(let ((idx (menu-current-item menu)))
- (list-ref (menu-items menu) idx)))
+ (if (>= idx (length (menu-items menu)))
+ #f
+ (list-ref (menu-items menu) idx))))
(define (menu-scroll-down menu step)
(let ((limit (- (length (menu-items menu))
- 147/197: gurses: In paragraph-format avoid use of car and cdr., (continued)
- 147/197: gurses: In paragraph-format avoid use of car and cdr., Danny Milosavljevic, 2017/07/03
- 144/197: gurses: Avoid one more use of car and cdr., Danny Milosavljevic, 2017/07/03
- 143/197: gurses: Add predicate to test if a complex char is blank., Danny Milosavljevic, 2017/07/03
- 149/197: gurses: Add new procedure "word-endings"., Danny Milosavljevic, 2017/07/03
- 155/197: installer: Use _ instead of M_ for host-name-refresh., Danny Milosavljevic, 2017/07/03
- 160/197: installer: New convenience procedures., Danny Milosavljevic, 2017/07/03
- 158/197: installer: Correct placement of gettext call., Danny Milosavljevic, 2017/07/03
- 163/197: gurses: Cache the windows of buttons., Danny Milosavljevic, 2017/07/03
- 172/197: gurses: Update the cursor position when posting the form., Danny Milosavljevic, 2017/07/03
- 165/197: installer: New procedure key-value-slurp., Danny Milosavljevic, 2017/07/03
- 175/197: gurses: Don't crash if asked for an item by an invalid index.,
Danny Milosavljevic <=
- 171/197: installer: New page to edit user accounts., Danny Milosavljevic, 2017/07/03
- 187/197: installer: Add procudure for starting a wireless interface., Danny Milosavljevic, 2017/07/03
- 192/197: installer: Only build if guile-ncurses is available., Danny Milosavljevic, 2017/07/03
- 68/197: installer: Add new page to set the system role., Danny Milosavljevic, 2017/07/03
- 117/197: installer: Remove unnecessary "begin"., Danny Milosavljevic, 2017/07/03
- 113/197: installer: Explicitly set the #:panel parameter for window creation procedures., Danny Milosavljevic, 2017/07/03
- 122/197: gurses: Populate the choices box in forms., Danny Milosavljevic, 2017/07/03
- 128/197: installer: Remove redundant list of file system types., Danny Milosavljevic, 2017/07/03
- 115/197: installer: New procedure refresh*., Danny Milosavljevic, 2017/07/03
- 153/197: installer: Add optional arguments to addstr*., Danny Milosavljevic, 2017/07/03