From c6ada706d624454f00a7bc70426510c6621677d7 Mon Sep 17 00:00:00 2001 From: nathan Date: Thu, 17 Aug 2017 15:25:21 +0200 Subject: [PATCH] Check for null message when getting the exception message --- src/dorkbox/util/OS.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/dorkbox/util/OS.java b/src/dorkbox/util/OS.java index 89b43e0..12a6d63 100644 --- a/src/dorkbox/util/OS.java +++ b/src/dorkbox/util/OS.java @@ -304,14 +304,19 @@ class OS { /** - * @return the first line of the exception message from 'throwable' + * @return the first line of the exception message from 'throwable', or the type if there was no message. */ public static String getExceptionMessage(final Throwable throwable) { String message = throwable.getMessage(); - int index = message.indexOf(OS.LINE_SEPARATOR); - if (index > -1) { - message = message.substring(0, index); + if (message != null) { + int index = message.indexOf(OS.LINE_SEPARATOR); + if (index > -1) { + message = message.substring(0, index); + } + } else { + message = throwable.getClass() + .getSimpleName(); } return message;