Skip to content

Commit 623a775

Browse files
committed
Add defaults to prevent exceptions
1 parent 52c18b4 commit 623a775

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

lib/util/track.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,17 @@
88
* This info isn’t used yet but suchs functionality allows line wrapping,
99
* and theoretically source maps (though, is there practical use in that?).
1010
*
11-
* @param {TrackFields} options
11+
* @param {TrackFields} options_
1212
*/
13-
export function track(options) {
14-
const now = options.now
15-
let lineShift = options.lineShift
16-
let line = now.line
17-
let column = now.column
13+
export function track(options_) {
14+
// Defaults are used to prevent crashes when older utilities somehow activate
15+
// this code.
16+
/* c8 ignore next 5 */
17+
const options = options_ || {}
18+
const now = options.now || {}
19+
let lineShift = options.lineShift || 0
20+
let line = now.line || 1
21+
let column = now.column || 1
1822

1923
return {move, current, shift}
2024

0 commit comments

Comments
 (0)