Skip to content

Commit

Permalink
do not render hz if no messages
Browse files Browse the repository at this point in the history
  • Loading branch information
james-rms committed Nov 1, 2023
1 parent 526626f commit 956c05b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions go/cli/mcap/cmd/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 956c05b

Please sign in to comment.