fixed nil pointer when closing stream
This commit is contained in:
parent
34c3c92ec3
commit
f8a2a32383
2 changed files with 3 additions and 1 deletions
|
@ -171,6 +171,7 @@ func Stream(c *gin.Context) {
|
|||
wg.Done()
|
||||
}()
|
||||
|
||||
wc.Close()
|
||||
wg.Wait()
|
||||
c.String(200, "")
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue