Jean Kruger
Committed by GitHub

Avoid a crash on reconnection when a track is disposed (#691)

  1 +---
  2 +"client-sdk-android": patch
  3 +---
  4 +
  5 +Avoid a crash on reconnection when a track is disposed
@@ -612,9 +612,15 @@ internal constructor( @@ -612,9 +612,15 @@ internal constructor(
612 612
613 if (engine.connectionState == ConnectionState.DISCONNECTED) { 613 if (engine.connectionState == ConnectionState.DISCONNECTED) {
614 onPublishFailure(TrackException.PublishException("Not connected!")) 614 onPublishFailure(TrackException.PublishException("Not connected!"))
  615 + return null
615 } 616 }
616 617
617 - val cid = track.rtcTrack.id() 618 + val cid = try {
  619 + track.rtcTrack.id()
  620 + } catch (e: Exception) {
  621 + onPublishFailure(TrackException.PublishException("Failed to get track id", e))
  622 + return null
  623 + }
618 624
619 // For fast publish, we can negotiate PC and request add track at the same time 625 // For fast publish, we can negotiate PC and request add track at the same time
620 suspend fun negotiate() { 626 suspend fun negotiate() {