diff --git a/go/cli/mcap/cmd/info.go b/go/cli/mcap/cmd/info.go index 234f30a4da..b1be5ccfab 100644 --- a/go/cli/mcap/cmd/info.go +++ b/go/cli/mcap/cmd/info.go @@ -145,8 +145,12 @@ func printInfo(w io.Writer, info *mcap.Info) error { } if info.Statistics != nil { channelMessageCount := info.Statistics.ChannelMessageCounts[chanID] - frequency := 1e9 * float64(channelMessageCount) / float64(end-start) - row = append(row, fmt.Sprintf("%*d msgs (%.2f Hz)", maxCountWidth, channelMessageCount, frequency)) + if (channelMessageCount > 0) { + frequency := 1e9 * float64(channelMessageCount) / float64(end-start) + row = append(row, fmt.Sprintf("%*d msgs (%.2f Hz)", maxCountWidth, channelMessageCount, frequency)) + } else { + row = append(row, fmt.Sprintf("%*d msgs", maxCountWidth, channelMessageCount)) + } } switch { case schema != nil: