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

Commit 8cb4593

Browse files
authoredSep 18, 2017
Fix fromObject when object is undefined
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 ```
1 parent 4b6cbcd commit 8cb4593

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎src/range.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class Range
4545
else if object instanceof this
4646
if copy then object.copy() else object
4747
else
48-
new this(object.start, object.end)
48+
if object != null then new this(object.start, object.end) else new this()
4949

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

0 commit comments

Comments
 (0)