From 05304cc5202ee08804172a67f6ca21a8719d553b Mon Sep 17 00:00:00 2001 From: Philipp Winter Date: Mon, 16 Nov 2020 12:25:09 -0800 Subject: [PATCH] Check if channel is closed. If our event channel is closed, our last read results in nil. This patch makes bridgestrap check for this condition before accessing the result's struct members. --- tor.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tor.go b/tor.go index 8451cca..cc5590a 100644 --- a/tor.go +++ b/tor.go @@ -222,6 +222,11 @@ func (c *TorContext) TestBridgeLines(bridgeLines []string) *TestResult { for { select { case ev := <-c.eventChan: + // Our channel is closed. + if ev == nil { + result.Error = "test aborted because bridgestrap is shutting down" + return result + } for _, line := range ev.RawLines { for bridgeLine, parser := range eventParsers { // Skip bridges that are done testing. -- GitLab