From e53ff365490279ed7dbd077c7b986d1ee7e153b3 Mon Sep 17 00:00:00 2001 From: Laurence Date: Mon, 2 Feb 2026 16:01:26 +0000 Subject: [PATCH] Fix empty report creation when no IPs found in file Bail early when file scan finds 0 valid IP addresses instead of creating an empty report with NaN% values. Fixes #19 Co-Authored-By: Claude Opus 4.5 --- cmd/ipdex/file/file.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/ipdex/file/file.go b/cmd/ipdex/file/file.go index fc90741..1b31ff1 100644 --- a/cmd/ipdex/file/file.go +++ b/cmd/ipdex/file/file.go @@ -73,6 +73,12 @@ func FileCommand(file string, forceRefresh bool, yes bool) { } } nbIPToProcess = len(ipsToProcess) + if nbIPToProcess == 0 { + if outputFormat == display.HumanFormat { + style.Info("No valid IP addresses found in the file.") + } + return + } } else { for _, ip := range report.IPs {