Skip to content

Commit 048c2df

Browse files
committed
Guard null nav context in Android Auto and queue source
1 parent 67ce88b commit 048c2df

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

lib/models/finamp_models.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1992,7 +1992,9 @@ class QueueItemSource {
19921992
type: QueueItemSourceNameType.preTranslated,
19931993
pretranslatedName:
19941994
baseItem.name ??
1995-
AppLocalizations.of(GlobalSnackbar.materialAppScaffoldKey.currentContext!)!.placeholderSource,
1995+
(GlobalSnackbar.materialAppScaffoldKey.currentContext != null
1996+
? AppLocalizations.of(GlobalSnackbar.materialAppScaffoldKey.currentContext!)!.placeholderSource
1997+
: "Playing"),
19961998
),
19971999
id: baseItem.id,
19982000
item: baseItem,

lib/services/android_auto_helper.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -532,9 +532,10 @@ class AndroidAutoHelper {
532532
mediaItems.add(
533533
MediaItem(
534534
id: QueueItemSourceNameType.shuffleAll.name,
535-
title:
536-
AppLocalizations.of(GlobalSnackbar.materialAppScaffoldKey.currentContext!)?.shuffleAll ??
537-
"Shuffle All Tracks",
535+
title: GlobalSnackbar.materialAppScaffoldKey.currentContext != null
536+
? (AppLocalizations.of(GlobalSnackbar.materialAppScaffoldKey.currentContext!)?.shuffleAll ??
537+
"Shuffle All Tracks")
538+
: "Shuffle All Tracks",
538539
playable: true,
539540
),
540541
);

0 commit comments

Comments
 (0)