Skip to content

Commit

Permalink
fix(core): do not throw when an exception lifecycleScope is null
Browse files Browse the repository at this point in the history
  • Loading branch information
ThibaultBee committed Aug 26, 2024
1 parent 7e712ac commit ab7784c
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,10 @@ class PreviewView @JvmOverloads constructor(
*/
set(value) {
stopPreviewInternal()
field = value
value?.let {
lifecycleScope?.launch {
startPreviewInternal(it, it.camera, size)
}
startPreviewIfReady(it, size, false)
}
field = value
}

/**
Expand Down Expand Up @@ -311,6 +309,7 @@ class PreviewView @JvmOverloads constructor(
listener?.onPreviewStarted()
} else {
Logger.w(TAG, "Invalid surface")
listener?.onPreviewFailed(IllegalStateException("Invalid surface"))
}
}
} catch (e: CancellationException) {
Expand Down

0 comments on commit ab7784c

Please sign in to comment.