Skip to content

Commit 8dd7db6

Browse files
ekohlnwoythal
authored andcommitted
Deal with the first token being "trailing whitespace"
If the token is considered "trailing whitespace" and needs to be deleted, it tries to remove the item from the linked list. However, that doesn't work on the first and last entries. There already is a clause for the last item, just not the first item.
1 parent 4d96c8e commit 8dd7db6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/puppet-lint/plugins/check_whitespace/trailing_whitespace.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def fix(problem)
3030

3131
prev_token = problem[:token].prev_token
3232
next_token = problem[:token].next_token
33-
prev_token.next_token = next_token
33+
prev_token.next_token = next_token unless prev_token.nil?
3434
next_token.prev_token = prev_token unless next_token.nil?
3535
tokens.delete(problem[:token])
3636
end

0 commit comments

Comments
 (0)