From 946b84daedaef05c0dfb7e2967c33109075f10a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Sun, 26 Nov 2023 14:19:24 +0100 Subject: [PATCH] fix crash if DIRENV_WATCHES is not set This shouldn't happen in our current usage but better safe than sorry. --- direnvrc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/direnvrc b/direnvrc index 60dafc1..65e8f59 100644 --- a/direnvrc +++ b/direnvrc @@ -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