diff --git a/classlib/src/main/java/org/teavm/classlib/java/util/TArrays.java b/classlib/src/main/java/org/teavm/classlib/java/util/TArrays.java index 75cfa4b5f..99e23bf56 100644 --- a/classlib/src/main/java/org/teavm/classlib/java/util/TArrays.java +++ b/classlib/src/main/java/org/teavm/classlib/java/util/TArrays.java @@ -217,6 +217,9 @@ public class TArrays extends TObject { } public static String toString(TObject[] a) { + if (a == null) { + return "null"; + } TStringBuilder sb = new TStringBuilder(); sb.append("["); for (int i = 0; i < a.length; ++i) { @@ -230,6 +233,9 @@ public class TArrays extends TObject { } public static String toString(boolean[] a) { + if (a == null) { + return "null"; + } TStringBuilder sb = new TStringBuilder(); sb.append("["); for (int i = 0; i < a.length; ++i) { @@ -243,6 +249,9 @@ public class TArrays extends TObject { } public static String toString(byte[] a) { + if (a == null) { + return "null"; + } TStringBuilder sb = new TStringBuilder(); sb.append("["); for (int i = 0; i < a.length; ++i) { @@ -256,6 +265,9 @@ public class TArrays extends TObject { } public static String toString(short[] a) { + if (a == null) { + return "null"; + } TStringBuilder sb = new TStringBuilder(); sb.append("["); for (int i = 0; i < a.length; ++i) { @@ -269,6 +281,9 @@ public class TArrays extends TObject { } public static String toString(char[] a) { + if (a == null) { + return "null"; + } TStringBuilder sb = new TStringBuilder(); sb.append("["); for (int i = 0; i < a.length; ++i) { @@ -282,6 +297,9 @@ public class TArrays extends TObject { } public static String toString(int[] a) { + if (a == null) { + return "null"; + } TStringBuilder sb = new TStringBuilder(); sb.append("["); for (int i = 0; i < a.length; ++i) { @@ -295,6 +313,9 @@ public class TArrays extends TObject { } public static String toString(long[] a) { + if (a == null) { + return "null"; + } TStringBuilder sb = new TStringBuilder(); sb.append("["); for (int i = 0; i < a.length; ++i) { @@ -308,6 +329,9 @@ public class TArrays extends TObject { } public static String toString(float[] a) { + if (a == null) { + return "null"; + } TStringBuilder sb = new TStringBuilder(); sb.append("["); for (int i = 0; i < a.length; ++i) { @@ -321,6 +345,9 @@ public class TArrays extends TObject { } public static String toString(double[] a) { + if (a == null) { + return "null"; + } TStringBuilder sb = new TStringBuilder(); sb.append("["); for (int i = 0; i < a.length; ++i) { @@ -1552,6 +1579,9 @@ public class TArrays extends TObject { } public static String deepToString(Object[] a) { + if (a == null) { + return "null"; + } StringBuilder sb = new StringBuilder(); deepToString(a, sb, new TArrayList<>()); return sb.toString();