Check whether platform has already exited in terminal error handler

This commit is contained in:
crschnick 2023-07-09 07:11:36 +00:00
parent b05d24dd14
commit 4c08385098

View file

@ -43,13 +43,19 @@ public class TerminalErrorHandler implements ErrorHandler {
} catch (InterruptedException ignored) { } catch (InterruptedException ignored) {
} }
} catch (Throwable r) { } catch (Throwable r) {
if (!"Toolkit already initialized".equals(r.getMessage())) { // Check if we already exited
// Check if platform initialization has failed if ("Platform.exit has been called".equals(r.getMessage())) {
PlatformState.setCurrent(PlatformState.EXITED);
return;
}
if ("Toolkit already initialized".equals(r.getMessage())) {
PlatformState.setCurrent(PlatformState.RUNNING);
} else {
// Platform initialization has failed in this case
event.clearAttachments(); event.clearAttachments();
handleSecondaryException(event, r); handleSecondaryException(event, r);
return; return;
} else {
PlatformState.setCurrent(PlatformState.RUNNING);
} }
} }
} }