From 2d4a6ff88bc154f8bcb03781b17926ede273423f Mon Sep 17 00:00:00 2001 From: cschantz Date: Wed, 19 Nov 2025 16:44:24 -0500 Subject: [PATCH] Fix division by zero in progress indicator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add check for total=0 before calculating percentage - Prevents crash when indexing empty user/database lists - Displays 100% completion for empty lists 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- lib/common-functions.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/common-functions.sh b/lib/common-functions.sh index db31f99..7f2952e 100755 --- a/lib/common-functions.sh +++ b/lib/common-functions.sh @@ -117,6 +117,13 @@ show_progress() { local current=$1 local total=$2 local message="$3" + + # Avoid division by zero + if [ "$total" -eq 0 ]; then + printf "\r[INFO] Progress: [####################] 100%% - %s" "$message" + return + fi + local percent=$((current * 100 / total)) local bars=$((percent / 5)) # 20 chars wide