Skip to content

Commit

Permalink
Fixes #1006 - handling invalid input source maps.
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubpawlowicz committed Mar 5, 2018
1 parent 913d72c commit 9e0a38e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions History.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Fixed issue [#988](https://github.com/jakubpawlowicz/clean-css/issues/988) - edge case in dropping default animation-duration.
* Fixed issue [#989](https://github.com/jakubpawlowicz/clean-css/issues/989) - edge case in removing unused at rules.
* Fixed issue [#1001](https://github.com/jakubpawlowicz/clean-css/issues/1001) - corrupted tokenizer state.
* Fixed issue [#1006](https://github.com/jakubpawlowicz/clean-css/issues/1006) - edge case in handling invalid source maps.
* Fixed issue [#1008](https://github.com/jakubpawlowicz/clean-css/issues/1008) - edge case in breaking up `font` shorthand.

[4.1.9 / 2017-09-19](https://github.com/jakubpawlowicz/clean-css/compare/v4.1.8...v4.1.9)
Expand Down
4 changes: 4 additions & 0 deletions lib/reader/input-source-map-tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ function originalPositionFor(maps, metadata, range, selectorFallbacks) {
originalPosition = maps[source].originalPositionFor(position);
}

if (!originalPosition || originalPosition.column < 0) {
return metadata;
}

if (originalPosition.line === null && line > 1 && selectorFallbacks > 0) {
return originalPositionFor(maps, [line - 1, column, source], range, selectorFallbacks - 1);
}
Expand Down

0 comments on commit 9e0a38e

Please sign in to comment.