Skip to content

Commit

Permalink
updated to handle missing song lyrics
Browse files Browse the repository at this point in the history
  • Loading branch information
ninjakappa007 committed Jan 22, 2024
1 parent 72ed3ce commit a7ab70d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/services/queries/lyrics.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ class LyricsQueries {
throw "No track currently";
}
final timedLyrics = await ServiceUtils.getTimedLyrics(track);
if (timedLyrics == null) throw Exception("Unable to find lyrics");
if (timedLyrics == null) {
return SubtitleSimple(errorMessage: "Unable to find lyrics");
}

return timedLyrics;
},
Expand Down Expand Up @@ -83,8 +85,8 @@ class LyricsQueries {
});

if (res.statusCode != 200) {
throw Exception("Unable to find lyrics");
}
return SubtitleSimple(errorMessage: "Unable to find lyrics");
}
final linesRaw = Map.castFrom<dynamic, dynamic, String, dynamic>(
jsonDecode(res.body),
)["lyrics"]?["lines"] as List?;
Expand Down

0 comments on commit a7ab70d

Please sign in to comment.