From 20d6fd70fee125c7785767df4ac661199b202dd0 Mon Sep 17 00:00:00 2001 From: David Florness Date: Fri, 31 Dec 2021 19:21:35 -0600 Subject: [PATCH] Explicitly don't allow showing results of election we're not in Having this in a separate conditional makes it clear why the program exited. Supporting showing results of elections the user is not in makes a lot of the assumptions that tallyard makes throughout the program no longer valid. In theory this should be supported at some point, but it's not a priority. --- cmd/tallyard/main.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/tallyard/main.go b/cmd/tallyard/main.go index a4b0391..f208375 100644 --- a/cmd/tallyard/main.go +++ b/cmd/tallyard/main.go @@ -111,10 +111,14 @@ func main() { if err != nil { log.Panic(err) } - if el == nil || el.LocalVoter == nil { + if el == nil { // no election selected; user likely hit C-c return } + if el.LocalVoter == nil { + fmt.Println("can't select election of which we are not a member; exiting") + return + } // wait for election to start if needed err = ui.ElectionWaitTUI(kill, client, el, electionsMap.EventStore) -- 2.38.4