Skip to content

Commit 4052700

Browse files
authored
Fix surface causing null pointer exception on some devices (#544)
* Fix surface null pointer exception * Add changeset * Call willNotProvideSurface when surface is null
1 parent 2237525 commit 4052700

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

.changeset/small-beds-add.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"client-sdk-android": patch
3+
---
4+
5+
Fix surface causing null pointer exception on some devices

livekit-android-camerax/src/main/java/livekit/org/webrtc/CameraXSession.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,9 @@ internal constructor(
149149

150150
surface = Surface(surfaceTextureHelper.surfaceTexture)
151151
surfaceProvider = SurfaceProvider { request ->
152-
request.provideSurface(surface!!, helperExecutor) { }
152+
surface?.let {
153+
request.provideSurface(it, helperExecutor) { }
154+
} ?: request.willNotProvideSurface()
153155
}
154156

155157
// Set image analysis - camera params

0 commit comments

Comments
 (0)