Skip to content

Commit

Permalink
Merge pull request atom#18060 from atom/dw-catch-json-exception
Browse files Browse the repository at this point in the history
Catch exceptions for bad package.json when looking for Atom repo in pwd
  • Loading branch information
daviwil authored Sep 15, 2018
2 parents e6507c5 + b35778b commit 699db30
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/main-process/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@ const args =
function isAtomRepoPath (repoPath) {
let packageJsonPath = path.join(repoPath, 'package.json')
if (fs.statSyncNoException(packageJsonPath)) {
let packageJson = CSON.readFileSync(packageJsonPath)
return packageJson.name === 'atom'
try {
let packageJson = CSON.readFileSync(packageJsonPath)
return packageJson.name === 'atom'
} catch (e) {
return false
}
}

return false
Expand Down

0 comments on commit 699db30

Please sign in to comment.