Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Fix fromObject when object is undefined #257

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bstream
Copy link

@bstream bstream commented Sep 18, 2017

In atom@1.20.0 there is an unrecoverable error occurring when parameter object is undefined.

Uncaught (in promise) TypeError: Cannot read property 'start' of undefined
    at Function.module.exports.Range.fromObject (/Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/range.js:33:37)
    at Function.module.exports.MarkerLayer.deserializeSnapshot (/Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/marker-layer.js:39:57)
    at History.module.exports.History.deserializeStack (/Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/history.js:427:60)
    at History.module.exports.History.deserialize (/Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/history.js:361:35)
    at /Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/text-buffer.js:264:30

NOTE:

  • This is only happening in one of my projects and I do not know the root cause. This PR is just to protect against this error.
  • I could not try this fix locally since atom seems to cache its dependencies (inline edits did not do anything).

In atom@1.20.0 there is an unrecoverable error occurring when parameter `object` is undefined.

```
Uncaught (in promise) TypeError: Cannot read property 'start' of undefined
    at Function.module.exports.Range.fromObject (/Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/range.js:33:37)
    at Function.module.exports.MarkerLayer.deserializeSnapshot (/Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/marker-layer.js:39:57)
    at History.module.exports.History.deserializeStack (/Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/history.js:427:60)
    at History.module.exports.History.deserialize (/Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/history.js:361:35)
    at /Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/text-buffer.js:264:30
```
@bstream
Copy link
Author

bstream commented Sep 18, 2017

If anyone else runs into this: This seems to happen due to a bad window state. Running atom with --clear-window-state when opening the project works fine for me.

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

Successfully merging this pull request may close these issues.

1 participant