Fallback to getPrimaryDisplay() if getDisplayMatching() returns null

This commit is contained in:
David Howell 2017-10-24 20:25:38 +10:30 committed by Ben Gotow
parent 7159b127e2
commit d0a91bea80

View file

@ -587,9 +587,9 @@ export default class AppEnvConstructor {
center() {
if (process.platform === 'linux') {
let dimensions = this.getWindowDimensions();
let bounds = remote.screen.getDisplayMatching(dimensions).bounds;
let x = bounds.x + ((bounds.width - dimensions.width) / 2);
let y = bounds.y + ((bounds.height - dimensions.height) / 2);
let display = remote.screen.getDisplayMatching(dimensions) || remote.screen.getPrimaryDisplay();
let x = display.bounds.x + ((display.bounds.width - dimensions.width) / 2);
let y = display.bounds.y + ((display.bounds.height - dimensions.height) / 2);
return this.setPosition(x, y);
} else {