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
;; process start even when ioctl on stdout's fd disagrees.
(or (ignore-errors
(let ((cols (parse-integer (sb-ext:posix-getenv "COLUMNS")
:junk-allowed t))
(rows (parse-integer (sb-ext:posix-getenv "LINES")
:junk-allowed t)))
(let* ((cstr (sb-ext:posix-getenv "COLUMNS"))
(rstr (sb-ext:posix-getenv "LINES"))
(cols (when cstr (parse-integer cstr :junk-allowed t)))
(rows (when rstr (parse-integer rstr :junk-allowed t))))
(when (and cols rows (> cols 0) (> rows 0))
(values cols rows))))
(values w h)))))

View File

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