Fix NPE in stacktraceAsStringRecursive method
Some checks failed
build-and-test / build (push) Failing after 1m23s
build-and-test / generate-javadoc (push) Failing after 1m26s
build-and-test / test (push) Failing after 1m29s

This commit is contained in:
JeremyStar™ 2024-12-02 02:31:04 +01:00
parent 92aa012738
commit 571d600b09
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D

View file

@ -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));