From 2aa9d5b24a4f7e445bda6888439789ec30cd6547 Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Mon, 17 Jul 2017 22:15:43 +0300 Subject: [PATCH] Fix unwrapping null JS functions in JSO --- .../src/main/java/org/teavm/jso/impl/JSNativeGenerator.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jso/impl/src/main/java/org/teavm/jso/impl/JSNativeGenerator.java b/jso/impl/src/main/java/org/teavm/jso/impl/JSNativeGenerator.java index 41fe6346a..6204f7b26 100644 --- a/jso/impl/src/main/java/org/teavm/jso/impl/JSNativeGenerator.java +++ b/jso/impl/src/main/java/org/teavm/jso/impl/JSNativeGenerator.java @@ -76,6 +76,8 @@ public class JSNativeGenerator implements Injector, DependencyPlugin, Generator String thisName = context.getParameterName(1); String methodName = context.getParameterName(2); + writer.append("if").ws().append("(").append(thisName).ws().append("===").ws().append("null)").ws() + .append("return null;").softNewLine(); writer.append("var result").ws().append("=").ws().append("{};").softNewLine(); writer.append("result[").append(methodName).append("]").ws().append("=").ws().append(thisName) .append(";").softNewLine();