path: Don't try to find empty commands

This would e.g. cause highlighting to be broken if you added an
executable file to $PATH
This commit is contained in:
Fabian Boehm 2022-09-14 18:18:08 +02:00
parent cfecc4cc35
commit 787ba6d951

View file

@ -43,6 +43,10 @@ static get_path_result_t path_get_path_core(const wcstring &cmd, const wcstring_
return S_ISREG(buff.st_mode) ? 0 : EACCES;
};
if (cmd.empty()) {
return noent_res;
}
// Commands cannot contain NUL byte.
if (cmd.find(L'\0') != wcstring::npos) {
return noent_res;