Skip to content

Commit

Permalink
cli: info: don't crash when channel has no schema (#584)
Browse files Browse the repository at this point in the history
**Public-Facing Changes**
Fixed a bug where `mcap info` would crash if a channel had no schema.


**Description**
Fixes #579
  • Loading branch information
jtbandes authored Sep 16, 2022
1 parent ac5bb02 commit dd26169
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion go/cli/mcap/cmd/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,13 @@ func printInfo(w io.Writer, info *mcap.Info) error {
if info.Statistics != nil {
row = append(row, fmt.Sprintf("%*d msgs (%.2f Hz)", maxCountWidth, channelMessageCount, frequency))
}
row = append(row, fmt.Sprintf(" : %s [%s]", schema.Name, schema.Encoding))
if schema != nil {
row = append(row, fmt.Sprintf(" : %s [%s]", schema.Name, schema.Encoding))
} else if channel.SchemaID != 0 {
row = append(row, fmt.Sprintf(" : <missing schema %d>", channel.SchemaID))
} else {
row = append(row, " : <no schema>")
}
rows = append(rows, row)
}
tw := tablewriter.NewWriter(buf)
Expand Down

0 comments on commit dd26169

Please sign in to comment.