kopia lustrzana https://github.com/TeamNewPipe/NewPipe
Prevent IllegalArgumentException when closing popup
rodzic
098c954ef1
commit
d4a33603ab
|
@ -1349,14 +1349,24 @@ public final class Player implements
|
||||||
|
|
||||||
public void removePopupFromView() {
|
public void removePopupFromView() {
|
||||||
if (windowManager != null) {
|
if (windowManager != null) {
|
||||||
final boolean isCloseOverlayHasParent = closeOverlayBinding != null
|
// wrap in try-catch since it could sometimes generate errors randomly
|
||||||
&& closeOverlayBinding.closeButton.getParent() != null;
|
try {
|
||||||
if (popupHasParent()) {
|
if (popupHasParent()) {
|
||||||
windowManager.removeView(binding.getRoot());
|
windowManager.removeView(binding.getRoot());
|
||||||
}
|
}
|
||||||
if (isCloseOverlayHasParent) {
|
} catch (final IllegalArgumentException e) {
|
||||||
|
Log.w(TAG, "Failed to remove popup from window manager", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
final boolean closeOverlayHasParent = closeOverlayBinding != null
|
||||||
|
&& closeOverlayBinding.getRoot().getParent() != null;
|
||||||
|
if (closeOverlayHasParent) {
|
||||||
windowManager.removeView(closeOverlayBinding.getRoot());
|
windowManager.removeView(closeOverlayBinding.getRoot());
|
||||||
}
|
}
|
||||||
|
} catch (final IllegalArgumentException e) {
|
||||||
|
Log.w(TAG, "Failed to remove popup overlay from window manager", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue