Skip to content

Commit 126f4b0

Browse files
committed
Fix crash when closing video detail fragment
This bug started appearing because the way to close the player is now unified in PlayerHolder.stopService(), which causes the player to reach back to the video detail fragment with a notification of the shutdown (i.e. onServiceStopped() is called). This is fixed by adding a nullability check on the binding.
1 parent 6558794 commit 126f4b0

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1848,13 +1848,16 @@ public void onPlayerError(final PlaybackException error, final boolean isCatchab
18481848

18491849
@Override
18501850
public void onServiceStopped() {
1851-
setOverlayPlayPauseImage(false);
1852-
if (currentInfo != null) {
1853-
updateOverlayData(currentInfo.getName(),
1854-
currentInfo.getUploaderName(),
1855-
currentInfo.getThumbnails());
1851+
// the binding could be null at this point, if the app is finishing
1852+
if (binding != null) {
1853+
setOverlayPlayPauseImage(false);
1854+
if (currentInfo != null) {
1855+
updateOverlayData(currentInfo.getName(),
1856+
currentInfo.getUploaderName(),
1857+
currentInfo.getThumbnails());
1858+
}
1859+
updateOverlayPlayQueueButtonVisibility();
18561860
}
1857-
updateOverlayPlayQueueButtonVisibility();
18581861
}
18591862

18601863
@Override

0 commit comments

Comments
 (0)