From 8dd344412e39538a30310a24d7a5c6d9f1a209d0 Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Sat, 17 Aug 2024 20:48:38 +0200 Subject: [PATCH] classlib: fix support of null string in System.out/err streams --- .../org/teavm/classlib/impl/console/JSStdoutPrintStream.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/classlib/src/main/java/org/teavm/classlib/impl/console/JSStdoutPrintStream.java b/classlib/src/main/java/org/teavm/classlib/impl/console/JSStdoutPrintStream.java index 76f2de9eb..9e3b99627 100644 --- a/classlib/src/main/java/org/teavm/classlib/impl/console/JSStdoutPrintStream.java +++ b/classlib/src/main/java/org/teavm/classlib/impl/console/JSStdoutPrintStream.java @@ -22,6 +22,9 @@ import org.teavm.jso.JSBody; public class JSStdoutPrintStream extends JsConsolePrintStream { @Override public void print(String s) { + if (s == null) { + s = "null"; + } if (PlatformDetector.isWebAssemblyGC()) { for (int i = 0; i < s.length(); ++i) { WasmGCSupport.putCharStdout(s.charAt(i));