Skip to content

Commit

Permalink
set nil to ch
Browse files Browse the repository at this point in the history
  • Loading branch information
mattn committed May 23, 2024
1 parent 0120ec1 commit ee54d25
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion opensearch/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ func (oss *OpensearchStorage) QueryEvents(ctx context.Context, filter nostr.Filt
ch <- evt
}
close(ch)
ch = nil
} else {
return nil, fmt.Errorf("error getting by id: %w", err)
}
Expand Down Expand Up @@ -152,7 +153,9 @@ func (oss *OpensearchStorage) QueryEvents(ctx context.Context, filter nostr.Filt
}
}
}
close(ch)
if ch != nil {
close(ch)
}
}()

return ch, nil
Expand Down

0 comments on commit ee54d25

Please sign in to comment.