Skip to content

Commit fa70f16

Browse files
Fix empty report creation when no IPs found in file (#22)
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 <noreply@anthropic.com>
1 parent 10f250b commit fa70f16

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

cmd/ipdex/file/file.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ func FileCommand(file string, forceRefresh bool, yes bool) {
7373
}
7474
}
7575
nbIPToProcess = len(ipsToProcess)
76+
if nbIPToProcess == 0 {
77+
if outputFormat == display.HumanFormat {
78+
style.Info("No valid IP addresses found in the file.")
79+
}
80+
return
81+
}
7682
} else {
7783

7884
for _, ip := range report.IPs {

0 commit comments

Comments
 (0)