From 0e2171b872bd7933fdc327911857292874ebd74a Mon Sep 17 00:00:00 2001 From: tzugen Date: Tue, 9 May 2023 11:48:08 +0200 Subject: [PATCH] Fix the warning 'ID must not be null' --- .../moire/ultrasonic/fragment/TrackCollectionFragment.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/fragment/TrackCollectionFragment.kt b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/fragment/TrackCollectionFragment.kt index 85e466dd..7d38ba24 100644 --- a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/fragment/TrackCollectionFragment.kt +++ b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/fragment/TrackCollectionFragment.kt @@ -574,14 +574,14 @@ open class TrackCollectionFragment( } else if (getVideos) { setTitle(R.string.main_videos) listModel.getVideos(refresh2) - } else if (getRandomTracks) { + } else if (id == null || getRandomTracks) { + // There seems to be a bug in ViewPager when resuming the Actitivy that subfragments + // arguments are empty. If we have no id, just show some random tracks setTitle(R.string.main_songs_random) listModel.getRandom(size, append) } else { setTitle(name) - requireNotNull(id) { - "ID must be set. NavArgs: ${navArgs.toBundle()}" - } + if (ActiveServerProvider.isID3Enabled()) { if (isAlbum) { listModel.getAlbum(refresh2, id, name)