mirror of
https://github.com/aler9/gortsplib
synced 2025-10-04 23:02:45 +08:00
server: fix crash that happens when a reader tries to setup a closed stream (https://github.com/aler9/rtsp-simple-server/issues/866)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package gortsplib
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -120,6 +121,10 @@ func (st *ServerStream) readerAdd(
|
||||
st.mutex.Lock()
|
||||
defer st.mutex.Unlock()
|
||||
|
||||
if st.readers == nil {
|
||||
return fmt.Errorf("stream is closed")
|
||||
}
|
||||
|
||||
if st.s == nil {
|
||||
st.s = ss.s
|
||||
|
||||
|
Reference in New Issue
Block a user