From 6bee85fefa968a632287d5830be6023b90b88068 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sat, 5 Mar 2016 21:50:05 -0800 Subject: [PATCH] expand_string should not return any results on error Fixes #2796 --- src/expand.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/expand.cpp b/src/expand.cpp index 34e861f64..c2b4258c8 100644 --- a/src/expand.cpp +++ b/src/expand.cpp @@ -1908,13 +1908,15 @@ expand_error_t expand_string(const wcstring &input, std::vector *o output_storage.clear(); } - /* Hack to un-expand tildes (see #647) */ - if (!(flags & EXPAND_SKIP_HOME_DIRECTORIES)) + if (total_result != EXPAND_ERROR) { - unexpand_tildes(input, &completions); + /* Hack to un-expand tildes (see #647) */ + if (!(flags & EXPAND_SKIP_HOME_DIRECTORIES)) + { + unexpand_tildes(input, &completions); + } + out_completions->insert(out_completions->end(), completions.begin(), completions.end()); } - - out_completions->insert(out_completions->end(), completions.begin(), completions.end()); return total_result; }