fix crash if DIRENV_WATCHES is not set

This shouldn't happen in our current usage but better safe than sorry.
This commit is contained in:
Jörg Thalheim 2023-11-26 14:19:24 +01:00
parent a20b32d9cd
commit 946b84daed

View file

@ -204,6 +204,9 @@ nix_direnv_watch_file() {
_nix_direnv_watches() {
local -n _watches=$1
if [[ -z "${DIRENV_WATCHES-}" ]]; then
return
fi
while IFS= read -r line; do
local regex='"path": "(.+)"$'
if [[ "$line" =~ $regex ]]; then