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()) {