mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-09-19 13:51:23 +00:00
Handle more platform initialization errors
This commit is contained in:
parent
3a47755c73
commit
1fb68f8ca1
|
@ -36,10 +36,10 @@ public class AppBundledFonts {
|
|||
|
||||
private static boolean canLoadFonts() {
|
||||
try {
|
||||
// This can fail if the found fonts can somehow not be loaded
|
||||
// This can fail if the found system fonts can somehow not be loaded
|
||||
Font.getDefault();
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
} catch (Throwable e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,10 +72,12 @@ public enum PlatformState {
|
|||
// Maybe related to https://bugs.openjdk.org/browse/JDK-8318129 as it prints the same error if not called
|
||||
// The headless check is not needed though but still done
|
||||
GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices();
|
||||
} catch (HeadlessException e) {
|
||||
TrackEvent.warn(e.getMessage());
|
||||
|
||||
// Catch more than just the headless exception in case the graphics environment initialization completely fails
|
||||
} catch (Throwable t) {
|
||||
TrackEvent.warn(t.getMessage());
|
||||
PlatformState.setCurrent(PlatformState.EXITED);
|
||||
return Optional.of(e);
|
||||
return Optional.of(t);
|
||||
}
|
||||
|
||||
// Check if we have no fonts and set properties to load bundled ones
|
||||
|
|
Loading…
Reference in a new issue