Prevent IllegalArgumentException when closing popup

pull/5442/head
Stypox 2021-01-17 14:04:07 +01:00
rodzic 098c954ef1
commit d4a33603ab
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4BDF1B40A49FDD23
2 zmienionych plików z 17 dodań i 7 usunięć

Wyświetl plik

@ -1349,14 +1349,24 @@ public final class Player implements
public void removePopupFromView() {
if (windowManager != null) {
final boolean isCloseOverlayHasParent = closeOverlayBinding != null
&& closeOverlayBinding.closeButton.getParent() != null;
// wrap in try-catch since it could sometimes generate errors randomly
try {
if (popupHasParent()) {
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());
}
} catch (final IllegalArgumentException e) {
Log.w(TAG, "Failed to remove popup overlay from window manager", e);
}
}
}