diff --git a/base/src/main/java/de/staropensource/engine/base/utility/misc/Miscellaneous.java b/base/src/main/java/de/staropensource/engine/base/utility/misc/Miscellaneous.java index af5b5f3..5fe8394 100644 --- a/base/src/main/java/de/staropensource/engine/base/utility/misc/Miscellaneous.java +++ b/base/src/main/java/de/staropensource/engine/base/utility/misc/Miscellaneous.java @@ -193,15 +193,15 @@ public final class Miscellaneous { output .append("\n") .append(stacktraceAsStringRecursive(throwable.getCause(), indent, includeHeader)); - if (throwable instanceof ClassNotFoundException exception) + if (throwable instanceof ClassNotFoundException exception && exception.getException() != null) output .append("\n") .append(stacktraceAsStringRecursive(exception.getException(), indent, includeHeader)); - if (throwable instanceof ExceptionInInitializerError exception) + if (throwable instanceof ExceptionInInitializerError exception && exception.getException() != null) output .append("\n") .append(stacktraceAsStringRecursive(exception.getException(), indent, includeHeader)); - if (throwable instanceof InvocationTargetException exception) + if (throwable instanceof InvocationTargetException exception && exception.getTargetException() != null) output .append("\n") .append(stacktraceAsStringRecursive(exception.getTargetException(), indent, includeHeader));