Compare commits

..

1 Commits

Author SHA1 Message Date
Benyamin Azarkhazin e0b7cdda80
fix nil pointer 2023-11-09 15:42:23 +03:30
2 changed files with 9 additions and 0 deletions

View File

@ -89,6 +89,10 @@ func (c *RoomController) Offer(ctx *gin.Context) {
c.helper.Response(ctx, struct{}{}, http.StatusNoContent)
{
ggid := c.repo.GetRoomGGID(reqModel.RoomId)
if ggid == nil {
println("ggid is nil, not answering for offer")
return
}
buffer, err := json.Marshal(dto.SetSDPReqModel{
PeerDTO: dto.PeerDTO{
RoomId: reqModel.RoomId,

View File

@ -556,6 +556,11 @@ func (r *RoomRepository) offerPeer(peer *Peer, roomId string) error {
return err
}
ggid := r.GetRoomGGID(roomId)
if ggid == nil {
println("[PC] ok not negotiating with peer", peer.ID, "(room is deleted)")
peer.HandshakeLock.Unlock()
return errors.New("room doesnt have ggid")
}
reqModel := dto.SetSDPReqModel{
GGID: *ggid,
PeerDTO: dto.PeerDTO{