Skip to content

guard app.setName in setupStealth to prevent crash#13

Open
surajmalthumkar8 wants to merge 1 commit intoTechyCSR:mainfrom
surajmalthumkar8:fix/guard-app-setname-crash
Open

guard app.setName in setupStealth to prevent crash#13
surajmalthumkar8 wants to merge 1 commit intoTechyCSR:mainfrom
surajmalthumkar8:fix/guard-app-setname-crash

Conversation

@surajmalthumkar8
Copy link
Copy Markdown

Summary

  • added a null check around app.setName() in setupStealth()
  • when ELECTRON_RUN_AS_NODE is set in the environment, the electron app module is not available and app.setName() throws, crashing the whole process before it even reaches app.whenReady()
  • this just wraps it in a safety check so it fails silently, the same call in onAppReady() still sets the name once the app is actually ready

How to reproduce

  1. set ELECTRON_RUN_AS_NODE=1 in your shell (some tools like VS Code extensions do this)
  2. run npm start
  3. app crashes with TypeError: Cannot read properties of undefined (reading 'setName')

Test plan

  • verified app launches normally on windows after the fix
  • stealth name still gets set correctly via the existing app.setName call in onAppReady()

app.setName crashes when ELECTRON_RUN_AS_NODE is set in the
environment since the electron app module is not available.
added a null check so it fails silently instead of killing the process.
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

Successfully merging this pull request may close these issues.

2 participants