@@ -132,9 +132,7 @@ public View onCreateView(@NonNull final LayoutInflater inflater,
132132 public void onViewCreated (@ NonNull final View rootView , final Bundle savedInstanceState ) {
133133 super .onViewCreated (rootView , savedInstanceState );
134134 channelBinding = FragmentChannelBinding .bind (rootView );
135- if (channelContentNotSupported ) {
136- showContentNotSupported ();
137- }
135+ showContentNotSupportedIfNeeded ();
138136 }
139137
140138 @ Override
@@ -532,12 +530,8 @@ public void handleResult(@NonNull final ChannelInfo result) {
532530 channelContentNotSupported = false ;
533531 for (final Throwable throwable : result .getErrors ()) {
534532 if (throwable instanceof ContentNotSupportedException ) {
535- /*
536- channelBinding might not be initialized when handleResult() is called
537- (e.g. after rotating the screen, https://github.com/TeamNewPipe/NewPipe/issues/6696)
538- showContentNotSupported() will be called later
539- */
540533 channelContentNotSupported = true ;
534+ showContentNotSupportedIfNeeded ();
541535 }
542536 }
543537
@@ -569,7 +563,13 @@ channelBinding might not be initialized when handleResult() is called
569563 });
570564 }
571565
572- private void showContentNotSupported () {
566+ private void showContentNotSupportedIfNeeded () {
567+ // channelBinding might not be initialized when handleResult() is called
568+ // (e.g. after rotating the screen, #6696)
569+ if (!channelContentNotSupported || channelBinding == null ) {
570+ return ;
571+ }
572+
573573 channelBinding .errorContentNotSupported .setVisibility (View .VISIBLE );
574574 channelBinding .channelKaomoji .setText ("(︶︹︺)" );
575575 channelBinding .channelKaomoji .setTextSize (TypedValue .COMPLEX_UNIT_SP , 45f );
0 commit comments