From db2c128b24b78d5f81d6a201641139dc536f3139 Mon Sep 17 00:00:00 2001 From: Aaron Gyes Date: Tue, 21 Jun 2016 10:28:04 -0700 Subject: 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) ``` --- src/input.cpp | 9 +++++++-- 1 file 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"), -- cgit v1.2.3