Fix error dialog being displayed in a headless context.
This was causing an infinite cycle of java.awt.HeadlessException in case handleError was called in an environment without display.
This commit is contained in:
parent
8738f961ea
commit
ce1eba944e
@ -518,13 +518,15 @@ public class Application implements SystemListener {
|
|||||||
public void handleError(String errMsg, Throwable t){
|
public void handleError(String errMsg, Throwable t){
|
||||||
// Print error to log.
|
// Print error to log.
|
||||||
logger.log(Level.SEVERE, errMsg, t);
|
logger.log(Level.SEVERE, errMsg, t);
|
||||||
// Display error message on screen
|
// Display error message on screen if not in headless mode
|
||||||
|
if (context.getType() != JmeContext.Type.Headless) {
|
||||||
if (t != null) {
|
if (t != null) {
|
||||||
JmeSystem.showErrorDialog(errMsg + "\n" + t.getClass().getSimpleName() +
|
JmeSystem.showErrorDialog(errMsg + "\n" + t.getClass().getSimpleName() +
|
||||||
(t.getMessage() != null ? ": " + t.getMessage() : ""));
|
(t.getMessage() != null ? ": " + t.getMessage() : ""));
|
||||||
} else {
|
} else {
|
||||||
JmeSystem.showErrorDialog(errMsg);
|
JmeSystem.showErrorDialog(errMsg);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
stop(); // stop the application
|
stop(); // stop the application
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user