1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-18 05:25:23 +00:00
This commit is contained in:
Darien Raymond 2018-07-23 23:39:55 +02:00
parent d16886e51c
commit cd7a8595d9
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -46,7 +46,7 @@ func (r *cachedReader) ReadMultiBuffer() (buf.MultiBuffer, error) {
r.Lock()
defer r.Unlock()
if !r.cache.IsEmpty() {
if r.cache != nil && !r.cache.IsEmpty() {
mb := r.cache
r.cache = nil
return mb, nil
@ -59,7 +59,7 @@ func (r *cachedReader) ReadMultiBufferTimeout(timeout time.Duration) (buf.MultiB
r.Lock()
defer r.Unlock()
if !r.cache.IsEmpty() {
if r.cache != nil && !r.cache.IsEmpty() {
mb := r.cache
r.cache = nil
return mb, nil
@ -70,8 +70,10 @@ func (r *cachedReader) ReadMultiBufferTimeout(timeout time.Duration) (buf.MultiB
func (r *cachedReader) CloseError() {
r.Lock()
r.cache.Release()
r.cache = nil
if r.cache != nil {
r.cache.Release()
r.cache = nil
}
r.Unlock()
r.reader.CloseError()
}