Skip to content

Commit 8dc0ccd

Browse files
committed
Check for empty input before evaluating expr
1 parent adb551d commit 8dc0ccd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

evil-common.el

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2042,7 +2042,8 @@ or a marker object pointing nowhere."
20422042
"Eval INPUT and return stringified result, if of a suitable type.
20432043
If INPUT starts with a number, +, -, or . use `calc-eval' instead."
20442044
(let* ((first-char (car (remove ?\s (string-to-list input))))
2045-
(calcable-p (or (<= ?0 first-char ?9) (memq first-char '(?- ?+ ?.))))
2045+
(calcable-p (and first-char (or (<= ?0 first-char ?9)
2046+
(memq first-char '(?- ?+ ?.)))))
20462047
(result (if calcable-p
20472048
(let ((calc-multiplication-has-precedence nil))
20482049
(calc-eval input))

0 commit comments

Comments
 (0)