mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-22 16:10:31 +00:00
Fix crash when rotating device on unsupported channels
This commit is contained in:
parent
629b685f5a
commit
2e771cd65a
@ -77,6 +77,8 @@ public class ChannelFragment extends BaseListInfoFragment<StreamInfoItem, Channe
|
||||
private final CompositeDisposable disposables = new CompositeDisposable();
|
||||
private Disposable subscribeButtonMonitor;
|
||||
|
||||
private boolean channelContentNotSupported;
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////
|
||||
// Views
|
||||
//////////////////////////////////////////////////////////////////////////*/
|
||||
@ -130,6 +132,9 @@ public class ChannelFragment extends BaseListInfoFragment<StreamInfoItem, Channe
|
||||
public void onViewCreated(@NonNull final View rootView, final Bundle savedInstanceState) {
|
||||
super.onViewCreated(rootView, savedInstanceState);
|
||||
channelBinding = FragmentChannelBinding.bind(rootView);
|
||||
if (channelContentNotSupported) {
|
||||
showContentNotSupported();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -524,9 +529,15 @@ public class ChannelFragment extends BaseListInfoFragment<StreamInfoItem, Channe
|
||||
playlistControlBinding.getRoot().setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
channelContentNotSupported = false;
|
||||
for (final Throwable throwable : result.getErrors()) {
|
||||
if (throwable instanceof ContentNotSupportedException) {
|
||||
showContentNotSupported();
|
||||
/*
|
||||
channelBinding might not be initialized when handleResult() is called
|
||||
(e.g. after rotating the screen, https://github.com/TeamNewPipe/NewPipe/issues/6696)
|
||||
showContentNotSupported() will be called later
|
||||
*/
|
||||
channelContentNotSupported = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user