diff --git a/src/backend/modern.lisp b/src/backend/modern.lisp index 4c15fcf..b9a8450 100644 --- a/src/backend/modern.lisp +++ b/src/backend/modern.lisp @@ -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))))) diff --git a/src/backend/simple.lisp b/src/backend/simple.lisp index 570ab9b..e2704a4 100644 --- a/src/backend/simple.lisp +++ b/src/backend/simple.lisp @@ -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)))))