Skip to content

Commit

Permalink
value out range fix for currentMedia getter
Browse files Browse the repository at this point in the history
  • Loading branch information
HemantKArya committed Oct 8, 2024
1 parent 80dace0 commit c3200d1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/services/bloomeePlayer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:Bloomee/model/saavnModel.dart';
import 'package:Bloomee/model/yt_music_model.dart';
import 'package:Bloomee/repository/Saavn/saavn_api.dart';
import 'package:Bloomee/repository/Youtube/yt_music_api.dart';
import 'package:Bloomee/routes_and_consts/global_conts.dart';
import 'package:Bloomee/routes_and_consts/global_str_consts.dart';
import 'package:Bloomee/screens/widgets/snackbar.dart';
import 'package:Bloomee/services/db/bloomee_db_service.dart';
Expand Down Expand Up @@ -86,8 +87,9 @@ class BloomeeMusicPlayer extends BaseAudioHandler
));
}

MediaItemModel get currentMedia =>
mediaItem2MediaItemModel(queue.value[currentPlayingIdx]);
MediaItemModel get currentMedia => queue.value.isNotEmpty
? mediaItem2MediaItemModel(queue.value[currentPlayingIdx])
: mediaItemModelNull;

@override
Future<void> play() async {
Expand Down

0 comments on commit c3200d1

Please sign in to comment.