bug(cloudflared): nil pointer deference on h2DictWriter Close()

Unlike other h2DictWriter methods, the Close() method does check whether
w.comp is nil.

This PR adds a check for non nil compressor before attempting to close

Bug: #141
This commit is contained in:
tim 2019-11-25 20:22:00 -08:00
parent 379cb16efe
commit 90595f321a
1 changed files with 4 additions and 1 deletions

View File

@ -542,7 +542,10 @@ func (w *h2DictWriter) Write(p []byte) (n int, err error) {
}
func (w *h2DictWriter) Close() error {
return w.comp.Close()
if w.comp != nil {
return w.comp.Close()
}
return nil
}
// From http2/hpack