aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Aaron Gyes <me@aaron.gy>2016-06-21 10:28:04 -0700
committerGravatar Aaron Gyes <me@aaron.gy>2016-06-21 10:30:53 -0700
commitdb2c128b24b78d5f81d6a201641139dc536f3139 (patch)
tree9285a559ff2bfd3bc94dc3c26fe0814f1027a0ba
parent10661bb024cd87fdb5452b86fcc74a58f7f678f1 (diff)
Fix crash with empty $TERM
``` ~ $ set -e TERM; fish Assertion failed: (!is_missing), function c_str, file src/env.cpp, line 690. fish: 'fish' terminated by signal SIGABRT (Abort) ```
-rw-r--r--src/input.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/input.cpp b/src/input.cpp
index b9132b2c..71690217 100644
--- a/src/input.cpp
+++ b/src/input.cpp
@@ -344,8 +344,13 @@ int input_init() {
int err_ret;
if (setupterm(NULL, STDOUT_FILENO, &err_ret) == ERR) {
env_var_t term = env_get_string(L"TERM");
- debug(0, _(L"Your TERM value of '%ls' is not valid"), term.c_str());
- debug(0, _(L"Check that your terminal type is supported on this system"));
+ if (term.missing_or_empty()) {
+ debug(0, _(L"Your TERM is unset or empty."));
+ } else {
+ debug(0, _(L"Your TERM value of '%ls' is not valid"), term.c_str());
+ debug(0, _(L"Check that your terminal type is supported on this system"));
+ }
+
env_set(L"TERM", DEFAULT_TERM, ENV_GLOBAL | ENV_EXPORT);
if (setupterm(NULL, STDOUT_FILENO, &err_ret) == ERR) {
debug(0, _(L"Unable to setup terminal using your TERM or the '%ls' fallback"),