From de6aaf18abf414f297abd09f30e767a37341bc37 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Mon, 6 Mar 2017 17:03:34 +0100 Subject: [PATCH] Merge pull request #1302 from pi-hole/fix/nowildcardlistfile Check for existence of wildcard blocking list (query adlists) --- pihole | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/pihole b/pihole index 97f749ab..dda6d750 100755 --- a/pihole +++ b/pihole @@ -127,17 +127,19 @@ queryFunc() { done # Scan for possible wildcard matches - local wildcards=($(processWildcards "${domain}")) - for domain in ${wildcards[@]}; do - result=$(scanList "\/${domain}\/" ${wildcardlist}) - # Remove empty lines before couting number of results - count=$(sed '/^\s*$/d' <<< "$result" | wc -l) - if [[ ${count} > 0 ]]; then - echo "::: Wildcard blocking ${domain} (${count} results)" - echo "${result}" - echo "" - fi - done + if [ -e "${wildcardlist}" ]; then + local wildcards=($(processWildcards "${domain}")) + for domain in ${wildcards[@]}; do + result=$(scanList "\/${domain}\/" ${wildcardlist}) + # Remove empty lines before couting number of results + count=$(sed '/^\s*$/d' <<< "$result" | wc -l) + if [[ ${count} > 0 ]]; then + echo "::: Wildcard blocking ${domain} (${count} results)" + echo "${result}" + echo "" + fi + done + fi exit 0 }