Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught Exception: TypeError: Cannot read property 'x' of undefined #260

Open
AndreTheHunter opened this issue Apr 11, 2022 · 1 comment

Comments

@AndreTheHunter
Copy link

AndreTheHunter commented Apr 11, 2022

On startup I get the following error:

Uncaught Exception:
TypeError: Cannot read property 'x' of undefined
at getBrowserWindowOptions (/Applications/DevHub.app/Contents/Resources/app.asar/dist/window.js:171:39)
at createWindow (/Applications/DevHub.app/Contents/Resources/app.asar/dist/window.js:67:46)
at Object.updateOrRecreateWindow (/Applications/DevHub.app/Contents/Resources/app.asar/dist/window.js:210:22)
at App.<anonymous> (/Applications/DevHub.app/Contents/Resources/app.asar/dist/index.js:113:16)
at App.emit (events.js:315:20)

Screen Shot 2022-04-11 at 10 02 29

The app seems to continue loading fine...

On MacOS Monterey 12.3 on MacBook Pro (16-inch, 2021)

@manojksarkar
Copy link

I've implemented the optional chaining to handle the potential undefined values for menubarWindowState and mainWindowState. The updated code snippet is as follows:

...(config.store.get('isMenuBarMode')
  ? {
      x: menubarWindowState?.x,
      y: menubarWindowState?.y,
      width: menubarWindowState?.width,
      height: menubarWindowState?.height,
      alwaysOnTop: true,
      center: false,
      frame: false,
      fullscreenable: false,
      maxWidth: screen.getDisplayFromCursor().size.width * 0.9,
      maxHeight: screen.getDisplayFromCursor().size.height,
      movable: false,
      skipTaskbar: true,
    }
  : {
      x: mainWindowState?.x,
      y: mainWindowState?.y,
      width: mainWindowState?.width,
      height: mainWindowState?.height,
      alwaysOnTop: false,
      center: true,
      frame: constants.FRAME_IS_DIFFERENT_BETWEEN_MODES,
      fullscreenable: true,
      maxWidth: undefined,
      maxHeight: undefined,
      movable: !config.store.get('lockOnCenter'),
      skipTaskbar: false,
    }),

As I don't have macOS, I couldn't verify whether the above check is working well or not. If it is not working as expected, please ensure that the init() function is called before this function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants