From 1c9dde379888b1dddb0352a95f2de211bfa42cbb Mon Sep 17 00:00:00 2001 From: Alan Noble Date: Sun, 3 Mar 2019 23:04:49 +0000 Subject: [PATCH 1/2] Don't call rv.Bitrate when rv is nil. --- cmd/revid-cli/main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/revid-cli/main.go b/cmd/revid-cli/main.go index 625d9356..dcc2118a 100644 --- a/cmd/revid-cli/main.go +++ b/cmd/revid-cli/main.go @@ -269,8 +269,9 @@ func run(cfg revid.Config) { case pin.Name == "X23": if rv == nil { pin.Value = -1 + } else { + pin.Value = rv.Bitrate() } - pin.Value = rv.Bitrate() case pin.Name[0] == 'X': return sds.ReadSystem(pin) default: From 313944de90535d35239e04ef8e0998a5fbf84322 Mon Sep 17 00:00:00 2001 From: Alan Noble Date: Sun, 3 Mar 2019 23:22:42 +0000 Subject: [PATCH 2/2] Made more idiomatic. --- cmd/revid-cli/main.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cmd/revid-cli/main.go b/cmd/revid-cli/main.go index dcc2118a..dda75858 100644 --- a/cmd/revid-cli/main.go +++ b/cmd/revid-cli/main.go @@ -267,9 +267,8 @@ func run(cfg revid.Config) { readPin := func(pin *netsender.Pin) error { switch { case pin.Name == "X23": - if rv == nil { - pin.Value = -1 - } else { + pin.Value = -1 + if rv != nil { pin.Value = rv.Bitrate() } case pin.Name[0] == 'X':