File tree Expand file tree Collapse file tree
app/src/main/java/com/sameerasw/airsync Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -189,7 +189,11 @@ class MainActivity : ComponentActivity() {
189189 splashScreen.setOnExitAnimationListener { splashScreenViewProvider ->
190190 try {
191191 val splashScreenView = splashScreenViewProvider.view
192- val splashIcon = splashScreenViewProvider.iconView
192+ val splashIcon = try {
193+ splashScreenViewProvider.iconView
194+ } catch (e: Exception ) {
195+ null
196+ }
193197
194198 // Retrieve last connected device in background while showing splash
195199 var deviceIconRes: Int? = null
@@ -235,7 +239,7 @@ class MainActivity : ComponentActivity() {
235239 fadeInIcon.doOnEnd {
236240 // Hold on device icon for 0.5s, then start outro animation
237241 try {
238- splashIcon .postDelayed({
242+ splashScreenView .postDelayed({
239243 startOutroAnimation(
240244 splashScreenView,
241245 splashIcon,
@@ -278,7 +282,7 @@ class MainActivity : ComponentActivity() {
278282 // No device icon found, or splashIcon is null/not ImageView (OEM device compatibility)
279283 // Proceed directly to outro after a brief hold
280284 try {
281- splashIcon .postDelayed({
285+ splashScreenView .postDelayed({
282286 startOutroAnimation(
283287 splashScreenView,
284288 splashIcon,
Original file line number Diff line number Diff line change @@ -169,8 +169,11 @@ class AirSyncViewModel(
169169 WebSocketUtil .unregisterManualConnectListener(manualConnectCanceler)
170170 } catch (_: Exception ) {
171171 }
172-
173- appContext?.unregisterReceiver(powerSaveReceiver)
172+ try {
173+ appContext?.unregisterReceiver(powerSaveReceiver)
174+ } catch (_: IllegalArgumentException ) {
175+ // Receiver was not registered
176+ }
174177 }
175178
176179 private fun startObservingDeviceChanges (context : Context ) {
You can’t perform that action at this time.
0 commit comments