Skip to content

Commit a5d601d

Browse files
committed
Fix crash when using stats command
Previously the stats command checked if the args slice was not nil, and then tried to access the first element. We should instead be checking if the slice has length > 0, as an empty slice passes the original check. Signed-off-by: Kevin Parsons <[email protected]>
1 parent ead8d31 commit a5d601d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cmd/crictl/stats.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ var statsCommand = cli.Command{
9292
defer closeConnection(context, runtimeConn)
9393

9494
id := context.String("id")
95-
if id == "" && context.Args() != nil {
95+
if id == "" && context.NArg() > 0 {
9696
id = context.Args()[0]
9797
}
9898

0 commit comments

Comments
 (0)