lib/scss_lint/linter.rb in scss_lint-0.43.0 vs lib/scss_lint/linter.rb in scss_lint-0.43.1
- old
+ new
@@ -179,9 +179,11 @@
# @return [String] the character at the given [Sass::Source::Position]
def character_at(source_position, offset = 0)
actual_line = source_position.line - 1
actual_offset = source_position.offset + offset - 1
+ return nil if actual_offset < 0
+
engine.lines.size > actual_line && engine.lines[actual_line][actual_offset]
end
# Starting at source_position (plus offset), search for pattern and return
# the offset from the source_position.