From cf6c05ac7905855590183b029b71d2acd8e2977f Mon Sep 17 00:00:00 2001 From: Zbynek Konecny Date: Fri, 20 Oct 2023 16:04:51 +0200 Subject: [PATCH] Avoid calling undefined method in UncaughtExceptionHandler (#18) Fixes #17 --- .../main/java/org/gwtproject/core/client/GWT.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/gwt-core/src/main/java/org/gwtproject/core/client/GWT.java b/gwt-core/src/main/java/org/gwtproject/core/client/GWT.java index 8b114a4..d8fea32 100644 --- a/gwt-core/src/main/java/org/gwtproject/core/client/GWT.java +++ b/gwt-core/src/main/java/org/gwtproject/core/client/GWT.java @@ -135,13 +135,14 @@ private static void addOnErrorHandler(Window window, Window.OnerrorFn onerrorFn) Window.OnerrorFn original = window.onerror; if (original == null) { window.onerror = onerrorFn; + } else { + window.onerror = + (p0, p1, p2, p3, p4) -> { + onerrorFn.onInvoke(p0, p1, p2, p3, p4); + original.onInvoke(p0, p1, p2, p3, p4); + return null; + }; } - window.onerror = - (p0, p1, p2, p3, p4) -> { - onerrorFn.onInvoke(p0, p1, p2, p3, p4); - original.onInvoke(p0, p1, p2, p3, p4); - return null; - }; } /**