From c1f64ba017b3294820ed5381cfd7a6e36501dcc8 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Thu, 27 Mar 2014 13:46:33 -0700 Subject: [PATCH] Make set_color fail silently if there is no argument (reintroducing 469743c). Fixes #1335 --- builtin_set_color.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/builtin_set_color.cpp b/builtin_set_color.cpp index 0fdc1ac0b..79a81bbb9 100644 --- a/builtin_set_color.cpp +++ b/builtin_set_color.cpp @@ -81,6 +81,12 @@ static int builtin_set_color(parser_t &parser, wchar_t **argv) int argc = builtin_count_args(argv); + /* Some code passes variables to set_color that don't exist, like $fish_user_whatever. As a hack, quietly return failure. */ + if (argc <= 1) + { + return EXIT_FAILURE; + } + const wchar_t *bgcolor = NULL; bool bold = false, underline=false; int errret;