From d381db6549faa1db0a50ed1e6115385af006e758 Mon Sep 17 00:00:00 2001 From: Robert Vollmer Date: Fri, 10 Jan 2025 22:59:23 +0100 Subject: [PATCH] fix: Don't crash on Android if data source throws Exception See https://github.com/immich-app/immich/issues/15230#issuecomment-2584312782. So far, only java.lang.Error was caught, but HttpDataSource.InvalidResponseCodeException is a java.lang.Exception. --- .../native_video_player/NativeVideoPlayerViewController.kt | 2 +- .../platform_interface/NativeVideoPlayerApi.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/android/src/main/kotlin/me/albemala/native_video_player/NativeVideoPlayerViewController.kt b/android/src/main/kotlin/me/albemala/native_video_player/NativeVideoPlayerViewController.kt index 61565ae..50a3b9c 100644 --- a/android/src/main/kotlin/me/albemala/native_video_player/NativeVideoPlayerViewController.kt +++ b/android/src/main/kotlin/me/albemala/native_video_player/NativeVideoPlayerViewController.kt @@ -134,7 +134,7 @@ class NativeVideoPlayerViewController( if (error.cause == null) { api.onError(Error("Unknown playback error occurred")) } else { - api.onError(error.cause as Error) + api.onError(error.cause as Throwable) } } } \ No newline at end of file diff --git a/android/src/main/kotlin/me/albemala/native_video_player/platform_interface/NativeVideoPlayerApi.kt b/android/src/main/kotlin/me/albemala/native_video_player/platform_interface/NativeVideoPlayerApi.kt index 799ba59..f6cc128 100644 --- a/android/src/main/kotlin/me/albemala/native_video_player/platform_interface/NativeVideoPlayerApi.kt +++ b/android/src/main/kotlin/me/albemala/native_video_player/platform_interface/NativeVideoPlayerApi.kt @@ -48,7 +48,7 @@ class NativeVideoPlayerApi( channel.invokeMethod("onPlaybackEnded", null) } - fun onError(error: Error) { + fun onError(error: Throwable) { channel.invokeMethod("onError", error.message) }