fix a crash risk

pull/132/head
macbookpro 6 years ago
parent 9810288c51
commit e60e735532

@ -235,6 +235,8 @@ func (client *RTSPClient) requestStream(timeout time.Duration) (err error) {
headers = make(map[string]string) headers = make(map[string]string)
headers["Accept"] = "application/sdp" headers["Accept"] = "application/sdp"
resp, err = client.Request("DESCRIBE", headers) resp, err = client.Request("DESCRIBE", headers)
if err != nil {
if resp != nil {
authorization, _ := client.checkAuth("DESCRIBE", resp) authorization, _ := client.checkAuth("DESCRIBE", resp)
if len(authorization) > 0 { if len(authorization) > 0 {
headers := make(map[string]string) headers := make(map[string]string)
@ -245,7 +247,10 @@ func (client *RTSPClient) requestStream(timeout time.Duration) (err error) {
if err != nil { if err != nil {
return err return err
} }
} else {
return err
}
}
_sdp, err := sdp.ParseString(resp.Body) _sdp, err := sdp.ParseString(resp.Body)
if err != nil { if err != nil {
return err return err

Loading…
Cancel
Save