lib/scss_lint/linter.rb in scss_lint-0.41.0 vs lib/scss_lint/linter.rb in scss_lint-0.42.0
- old
+ new
@@ -66,11 +66,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
- engine.lines[actual_line][actual_offset]
+ engine.lines.size > actual_line && engine.lines[actual_line][actual_offset]
end
# Extracts the original source code given a range.
#
# @param source_range [Sass::Source::Range]
@@ -125,12 +125,12 @@
# Visit the selector of a rule if parsed rules are available
if node.is_a?(Sass::Tree::RuleNode) && node.parsed_rules
visit_selector(node.parsed_rules)
end
- @comment_processor.before_node_visit(node)
+ @comment_processor.before_node_visit(node) if @engine.any_control_commands
super
- @comment_processor.after_node_visit(node)
+ @comment_processor.after_node_visit(node) if @engine.any_control_commands
end
# Redefine so we can set the `node_parent` of each node
#
# @param parent [Sass::Tree::Node, Sass::Script::Tree::Node,