From 8779c49c3e596eb7d907356eb149e49866e171ac Mon Sep 17 00:00:00 2001 From: Steve Hannah Date: Thu, 19 Feb 2015 08:37:58 -0800 Subject: [PATCH] Fixed issue with null strings in (). --- teavm-core/src/main/java/org/teavm/javascript/Renderer.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/teavm-core/src/main/java/org/teavm/javascript/Renderer.java b/teavm-core/src/main/java/org/teavm/javascript/Renderer.java index 1a55f31dd..706eda6ba 100644 --- a/teavm-core/src/main/java/org/teavm/javascript/Renderer.java +++ b/teavm-core/src/main/java/org/teavm/javascript/Renderer.java @@ -225,6 +225,9 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext private void renderRuntimeString() throws IOException { MethodReference stringCons = new MethodReference(String.class, "", char[].class, void.class); writer.append("function $rt_str(str) {").indent().softNewLine(); + writer.append("if (str===null){").indent().softNewLine(); + writer.append("return null;").softNewLine(); + writer.outdent().append("}").softNewLine(); writer.append("var characters = $rt_createCharArray(str.length);").softNewLine(); writer.append("var charsBuffer = characters.data;").softNewLine(); writer.append("for (var i = 0; i < str.length; i = (i + 1) | 0) {").indent().softNewLine();