Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixes #1006 - handling invalid input source maps.
  • 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
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
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.