fix linter base helper methods to check for nil input

This fixes a bug in linter.rb which is exposed in Linter::UnnecessaryStringOutput where certain helper methods assumed non-nil input.