From 0157ac35a4a20a800273dda61aea429fe148b279 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Sun, 1 Aug 2021 12:15:39 +0200 Subject: [PATCH] Autoload: Ignore empty and effectively empty commands Fixes #8195. --- src/autoload.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/autoload.cpp b/src/autoload.cpp index 2387e990e..c686e3542 100644 --- a/src/autoload.cpp +++ b/src/autoload.cpp @@ -73,6 +73,11 @@ class autoload_file_cache_t { }; maybe_t autoload_file_cache_t::locate_file(const wcstring &cmd) const { + // If the command is empty or starts with NULL (i.e. is empty as a path) + // we'd try to source the *directory*, which exists. + // So instead ignore these here. + if (cmd.empty()) return none(); + if (cmd[0] == L'\0') return none(); // Re-use the storage for path. wcstring path; for (const wcstring &dir : dirs()) {