fix: handle nil env vars in backend-size

parse-integer errors on nil input. Guard with when before parsing.
This commit is contained in:
2026-05-14 13:03:42 -04:00
parent 0e0151664e
commit 1ac6ca02ee
2 changed files with 8 additions and 8 deletions

View File

@@ -185,10 +185,10 @@ as a fallback when a keyword is not in *named-colors*.")
;; $LINES from the shell, which reflect the true size at ;; $LINES from the shell, which reflect the true size at
;; process start even when ioctl on stdout's fd disagrees. ;; process start even when ioctl on stdout's fd disagrees.
(or (ignore-errors (or (ignore-errors
(let ((cols (parse-integer (sb-ext:posix-getenv "COLUMNS") (let* ((cstr (sb-ext:posix-getenv "COLUMNS"))
:junk-allowed t)) (rstr (sb-ext:posix-getenv "LINES"))
(rows (parse-integer (sb-ext:posix-getenv "LINES") (cols (when cstr (parse-integer cstr :junk-allowed t)))
:junk-allowed t))) (rows (when rstr (parse-integer rstr :junk-allowed t))))
(when (and cols rows (> cols 0) (> rows 0)) (when (and cols rows (> cols 0) (> rows 0))
(values cols rows)))) (values cols rows))))
(values w h))))) (values w h)))))

View File

@@ -44,10 +44,10 @@
(if (and (> w 80) (> h 24)) (if (and (> w 80) (> h 24))
(values w h) (values w h)
(or (ignore-errors (or (ignore-errors
(let ((cols (parse-integer (sb-ext:posix-getenv "COLUMNS") (let* ((cstr (sb-ext:posix-getenv "COLUMNS"))
:junk-allowed t)) (rstr (sb-ext:posix-getenv "LINES"))
(rows (parse-integer (sb-ext:posix-getenv "LINES") (cols (when cstr (parse-integer cstr :junk-allowed t)))
:junk-allowed t))) (rows (when rstr (parse-integer rstr :junk-allowed t))))
(when (and cols rows (> cols 0) (> rows 0)) (when (and cols rows (> cols 0) (> rows 0))
(values cols rows)))) (values cols rows))))
(values w h))))) (values w h)))))