summary refs log tree commit diff
path: root/gnu/installer
diff options
context:
space:
mode:
authorMathieu Othacehe <othacehe@gnu.org>2021-01-12 16:26:07 +0100
committerMathieu Othacehe <othacehe@gnu.org>2021-01-12 16:40:27 +0100
commitbb4e67415eb6d9871ee1b50b0a01e08c19f4809a (patch)
tree11b6f0c7386119f69f387ed090c9d13e90b9c3c4 /gnu/installer
parent55157c90711662c24c7627189020e3a5aeafa2ba (diff)
downloadguix-bb4e67415eb6d9871ee1b50b0a01e08c19f4809a.tar.gz
installer: Fix crash in parameters menu.
Fixes: <https://issues.guix.gnu.org/45378>.

* gnu/installer/newt/keymap.scm (run-layout-page): Return false when
"Continue" button is pressed.
(run-keymap-page): Do not try to compute variants if layout is false. Also do
not try to format the result if layout is false.
* gnu/installer.scm (compute-keymap-step): Do not apply keymap if
"run-keymap-page" returns false.
Diffstat (limited to 'gnu/installer')
-rw-r--r--gnu/installer/newt/keymap.scm21
1 files changed, 13 insertions, 8 deletions
diff --git a/gnu/installer/newt/keymap.scm b/gnu/installer/newt/keymap.scm
index 1b3af2f158..92f7f46f34 100644
--- a/gnu/installer/newt/keymap.scm
+++ b/gnu/installer/newt/keymap.scm
@@ -56,7 +56,7 @@ different layout at any time from the parameters menu.")))
        (else (G_ "Exit")))
      #:button-callback-procedure
      (case context
-       ((param) (const #t))
+       ((param) (const #f))
        (else
         (lambda _
           (raise
@@ -183,7 +183,9 @@ options."
       (compute
        (lambda (result _)
          (let* ((layout (result-step result 'layout))
-                (variants (x11-keymap-layout-variants layout)))
+                (variants (if layout
+                              (x11-keymap-layout-variants layout)
+                              '())))
            ;; Return #f if the layout does not have any variant.
            (and (not (null? variants))
                 (run-variant-page
@@ -196,16 +198,19 @@ options."
                        (gettext (x11-keymap-layout-description layout)
                                 "xkeyboard-config")))))))))))
 
-  (define (format-result result)
-    (let ((layout (x11-keymap-layout-name
-                   (result-step result 'layout)))
-          (variant (and=> (result-step result 'variant)
+  (define (format-result layout variant)
+    (let ((layout (x11-keymap-layout-name layout))
+          (variant (and=> variant
                           (lambda (variant)
                             (gettext (x11-keymap-variant-name variant)
                                      "xkeyboard-config")))))
       (toggleable-latin-layout layout variant)))
-  (format-result
-   (run-installer-steps #:steps keymap-steps)))
+
+  (let* ((result (run-installer-steps #:steps keymap-steps))
+         (layout (result-step result 'layout))
+         (variant (result-step result 'variant)))
+    (and layout
+         (format-result layout variant))))
 
 (define (keyboard-layout->configuration keymap)
   "Return the operating system configuration snippet to install KEYMAP."