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

Commit

Permalink
Fix fromObject when object is undefined
Browse files Browse the repository at this point in the history
In [email protected] 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
```
  • Loading branch information
bstream authored Sep 18, 2017
1 parent 4b6cbcd commit 8cb4593
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/range.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Range
else if object instanceof this
if copy then object.copy() else object
else
new this(object.start, object.end)
if object != null then new this(object.start, object.end) else new this()

# Returns a range based on an optional starting point and the given text. If
# no starting point is given it will be assumed to be [0, 0].
Expand Down

0 comments on commit 8cb4593

Please sign in to comment.