Skip to content
This repository has been archived by the owner on Aug 27, 2024. It is now read-only.

Commit

Permalink
fixes a crash where playerController was not initialized
Browse files Browse the repository at this point in the history
  • Loading branch information
y20k committed Mar 16, 2021
1 parent 558b0fc commit 1133c61
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ android {
applicationId 'org.y20k.transistor'
minSdkVersion 25
targetSdkVersion 30
versionCode 83
versionName '4.0.12'
versionCode 84
versionName '4.0.13'
resConfigs "en", "ar", "ca", "cs","de", "el", "eo", "es", "eu", "fr", "he", "hr", "id", "in", "it", "ja", "kab", "nb-rNO", "nl", "pa", "pl", "pt", "pt-rBR", "ru", "sk", "sl", "sr", "th", "tr", "uk", "zh-rCN"
}

Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/org/y20k/transistor/PlayerFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ class PlayerFragment: Fragment(), CoroutineScope,
override fun onStop() {
super.onStop()
// (see "stay in sync with the MediaSession")
playerController.unregisterCallback(mediaControllerCallback)
if (this::playerController.isInitialized) playerController.unregisterCallback(mediaControllerCallback)
mediaBrowser.disconnect()
playerServiceConnected = false
}
Expand Down Expand Up @@ -665,7 +665,7 @@ class PlayerFragment: Fragment(), CoroutineScope,
private val periodicProgressUpdateRequestRunnable: Runnable = object : Runnable {
override fun run() {
// request current playback position
playerController.requestProgressUpdate(resultReceiver)
if (this@PlayerFragment::playerController.isInitialized) playerController.requestProgressUpdate(resultReceiver)
// use the handler to start runnable again after specified delay
handler.postDelayed(this, 500)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ object FileHelper {
true -> try {
collection = getCustomGson().fromJson(json, collection::class.java)
} catch (e: Exception) {
LogHelper.e(TAG, "Error Reading collection.\nContent: $json")
e.printStackTrace()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,9 @@ class PlayerService(): MediaBrowserServiceCompat() {
if (player.isPlaying) {
//player.seekTo(player.bufferedPosition)
notificationHelper.showNotificationForPlayer(player)
} else {
// reset metadata
updateMetadata(null)
}
}

Expand Down
6 changes: 6 additions & 0 deletions metadata/en-US/changelogs/84.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# v4.0.13 - Andy Warhol

**2021-03-16**

- tweaks the "currently playing" display
- fixes a rare crash

0 comments on commit 1133c61

Please sign in to comment.