mirror of
https://github.com/atom/atom.git
synced 2026-02-02 10:45:14 -05:00
Catch and log errors parsing window state
Previously if a read or parse error occurred the window would never show and the dev tools would be inaccessible.
This commit is contained in:
@@ -241,9 +241,15 @@ window.atom =
|
||||
windowState
|
||||
|
||||
getWindowState: (keyPath) ->
|
||||
return {} unless fsUtils.exists(@getWindowStatePath())
|
||||
windowStatePath = @getWindowStatePath()
|
||||
return {} unless fsUtils.exists(windowStatePath)
|
||||
|
||||
try
|
||||
windowState = JSON.parse(fsUtils.read(windowStatePath) or '{}')
|
||||
catch error
|
||||
console.warn "Error parsing window state: #{windowStatePath}", error.stack, error
|
||||
windowState = {}
|
||||
|
||||
windowState = JSON.parse(fsUtils.read(@getWindowStatePath()) or '{}')
|
||||
if keyPath
|
||||
_.valueForKeyPath(windowState, keyPath)
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user