Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: unexpected crashes from seekbar preview bitmap parsing #4745

Merged
merged 1 commit into from
Sep 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
/**
* Cut off a new bitmap from the image that contains multiple preview thumbnails
*/
private fun cutBitmapFromPreviewFrame(bitmap: Bitmap, previewFrame: PreviewFrame): Bitmap {
val positionX = previewFrame.positionX * previewFrame.frameWidth
val positionY = previewFrame.positionY * previewFrame.frameHeight
val width = minOf(previewFrame.frameWidth, bitmap.width - positionX)
val height = minOf(previewFrame.frameHeight, bitmap.height - positionY)
private fun cutBitmapFromPreviewFrame(bitmap: Bitmap, previewFrame: PreviewFrame): Bitmap? {
val offsetX = previewFrame.positionX * previewFrame.frameWidth
val offsetY = previewFrame.positionY * previewFrame.frameHeight

return Bitmap.createBitmap(bitmap, positionX, positionY, width, height)
return runCatching {
Bitmap.createBitmap(bitmap, offsetX, offsetY, previewFrame.frameWidth, previewFrame.frameHeight)

Check failure on line 28 in app/src/main/java/com/github/libretube/util/OnlineTimeFrameReceiver.kt

View workflow job for this annotation

GitHub Actions / Check Code Quality

[ktlint] reported by reviewdog 🐶 Exceeded max line length (100) Raw Output: app/src/main/java/com/github/libretube/util/OnlineTimeFrameReceiver.kt:28:1: error: Exceeded max line length (100) (standard:max-line-length)

Check failure on line 28 in app/src/main/java/com/github/libretube/util/OnlineTimeFrameReceiver.kt

View workflow job for this annotation

GitHub Actions / Check Code Quality

[ktlint] reported by reviewdog 🐶 Argument should be on a separate line (unless all arguments can fit a single line) Raw Output: app/src/main/java/com/github/libretube/util/OnlineTimeFrameReceiver.kt:28:33: error: Argument should be on a separate line (unless all arguments can fit a single line) (standard:argument-list-wrapping)

Check failure on line 28 in app/src/main/java/com/github/libretube/util/OnlineTimeFrameReceiver.kt

View workflow job for this annotation

GitHub Actions / Check Code Quality

[ktlint] reported by reviewdog 🐶 Argument should be on a separate line (unless all arguments can fit a single line) Raw Output: app/src/main/java/com/github/libretube/util/OnlineTimeFrameReceiver.kt:28:41: error: Argument should be on a separate line (unless all arguments can fit a single line) (standard:argument-list-wrapping)

Check failure on line 28 in app/src/main/java/com/github/libretube/util/OnlineTimeFrameReceiver.kt

View workflow job for this annotation

GitHub Actions / Check Code Quality

[ktlint] reported by reviewdog 🐶 Argument should be on a separate line (unless all arguments can fit a single line) Raw Output: app/src/main/java/com/github/libretube/util/OnlineTimeFrameReceiver.kt:28:50: error: Argument should be on a separate line (unless all arguments can fit a single line) (standard:argument-list-wrapping)

Check failure on line 28 in app/src/main/java/com/github/libretube/util/OnlineTimeFrameReceiver.kt

View workflow job for this annotation

GitHub Actions / Check Code Quality

[ktlint] reported by reviewdog 🐶 Argument should be on a separate line (unless all arguments can fit a single line) Raw Output: app/src/main/java/com/github/libretube/util/OnlineTimeFrameReceiver.kt:28:59: error: Argument should be on a separate line (unless all arguments can fit a single line) (standard:argument-list-wrapping)

Check failure on line 28 in app/src/main/java/com/github/libretube/util/OnlineTimeFrameReceiver.kt

View workflow job for this annotation

GitHub Actions / Check Code Quality

[ktlint] reported by reviewdog 🐶 Argument should be on a separate line (unless all arguments can fit a single line) Raw Output: app/src/main/java/com/github/libretube/util/OnlineTimeFrameReceiver.kt:28:84: error: Argument should be on a separate line (unless all arguments can fit a single line) (standard:argument-list-wrapping)

Check failure on line 28 in app/src/main/java/com/github/libretube/util/OnlineTimeFrameReceiver.kt

View workflow job for this annotation

GitHub Actions / Check Code Quality

[ktlint] reported by reviewdog 🐶 Missing newline before ")" Raw Output: app/src/main/java/com/github/libretube/util/OnlineTimeFrameReceiver.kt:28:108: error: Missing newline before ")" (standard:argument-list-wrapping)
}.getOrNull()
}

/**
Expand Down
Loading