mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-10-31 15:23:00 +00:00 
			
		
		
		
	Prevent IllegalArgumentException when closing popup
This commit is contained in:
		| @@ -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); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Stypox
					Stypox