Skip to content

Commit 29b44a1

Browse files
authored
Merge pull request #5971 from sauravrao637/issueFix5968
App Crashes when no videos in last played and user interacts with playlistController fix
2 parents 43f8540 + 856a398 commit 29b44a1

File tree

2 files changed

+27
-20
lines changed

2 files changed

+27
-20
lines changed

app/src/main/java/org/schabi/newpipe/about/LicenseFragmentHelper.kt

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,21 @@ object LicenseFragmentHelper {
5858
*/
5959
private fun getLicenseStylesheet(context: Context): String {
6060
val isLightTheme = ThemeHelper.isLightThemeSelected(context)
61-
return ("body{padding:12px 15px;margin:0;" + "background:#" + getHexRGBColor(
62-
context,
63-
if (isLightTheme) R.color.light_license_background_color
64-
else R.color.dark_license_background_color
65-
) + ";" + "color:#" + getHexRGBColor(
66-
context,
67-
if (isLightTheme) R.color.light_license_text_color
68-
else R.color.dark_license_text_color
69-
) + "}" + "a[href]{color:#" + getHexRGBColor(
70-
context,
71-
if (isLightTheme) R.color.light_youtube_primary_color
72-
else R.color.dark_youtube_primary_color
73-
) + "}" + "pre{white-space:pre-wrap}")
61+
return (
62+
"body{padding:12px 15px;margin:0;" + "background:#" + getHexRGBColor(
63+
context,
64+
if (isLightTheme) R.color.light_license_background_color
65+
else R.color.dark_license_background_color
66+
) + ";" + "color:#" + getHexRGBColor(
67+
context,
68+
if (isLightTheme) R.color.light_license_text_color
69+
else R.color.dark_license_text_color
70+
) + "}" + "a[href]{color:#" + getHexRGBColor(
71+
context,
72+
if (isLightTheme) R.color.light_youtube_primary_color
73+
else R.color.dark_youtube_primary_color
74+
) + "}" + "pre{white-space:pre-wrap}"
75+
)
7476
}
7577

7678
/**

app/src/main/java/org/schabi/newpipe/util/NavigationHelper.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ public final class NavigationHelper {
6262
public static final String MAIN_FRAGMENT_TAG = "main_fragment_tag";
6363
public static final String SEARCH_FRAGMENT_TAG = "search_fragment_tag";
6464

65-
private NavigationHelper() { }
65+
private NavigationHelper() {
66+
}
6667

6768
/*//////////////////////////////////////////////////////////////////////////
6869
// Players
@@ -111,18 +112,22 @@ public static <T> Intent getPlayerEnqueueIntent(@NonNull final Context context,
111112
public static void playOnMainPlayer(final AppCompatActivity activity,
112113
@NonNull final PlayQueue playQueue) {
113114
final PlayQueueItem item = playQueue.getItem();
114-
assert item != null;
115-
openVideoDetailFragment(activity, activity.getSupportFragmentManager(),
116-
item.getServiceId(), item.getUrl(), item.getTitle(), playQueue, false);
115+
if (item != null) {
116+
openVideoDetailFragment(activity, activity.getSupportFragmentManager(),
117+
item.getServiceId(), item.getUrl(), item.getTitle(), playQueue,
118+
false);
119+
}
117120
}
118121

119122
public static void playOnMainPlayer(final Context context,
120123
@NonNull final PlayQueue playQueue,
121124
final boolean switchingPlayers) {
122125
final PlayQueueItem item = playQueue.getItem();
123-
assert item != null;
124-
openVideoDetail(context,
125-
item.getServiceId(), item.getUrl(), item.getTitle(), playQueue, switchingPlayers);
126+
if (item != null) {
127+
openVideoDetail(context,
128+
item.getServiceId(), item.getUrl(), item.getTitle(), playQueue,
129+
switchingPlayers);
130+
}
126131
}
127132

128133
public static void playOnPopupPlayer(final Context context,

0 commit comments

Comments
 (0)