From f8a2a323832d0d0b4c14b45702815ca67c5c12b0 Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Fri, 22 Apr 2016 17:50:28 -0700 Subject: [PATCH] fixed nil pointer when closing stream --- api/queue.go | 1 + stream/stream_impl.go | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/api/queue.go b/api/queue.go index 269f81e82..d18c544c6 100644 --- a/api/queue.go +++ b/api/queue.go @@ -171,6 +171,7 @@ func Stream(c *gin.Context) { wg.Done() }() + wc.Close() wg.Wait() c.String(200, "") diff --git a/stream/stream_impl.go b/stream/stream_impl.go index 5411e26bb..9be945c9a 100644 --- a/stream/stream_impl.go +++ b/stream/stream_impl.go @@ -61,8 +61,9 @@ func (s *stream) Delete(name string) error { if !s.exists(name) { return fmt.Errorf("stream: cannot delete stream %s, not found", name) } + w := s.writers[name] delete(s.writers, name) - return s.writers[name].Close() + return w.Close() } func (s *stream) exists(name string) bool {