From 7392898743fbd84a98ffc0ebd0b1bc7a34df27e8 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Wed, 26 Nov 2014 14:09:46 -0800 Subject: [PATCH] Handle nil as a sass_filename. Closes #1883. --- cli/lib/compass/sass_compiler.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cli/lib/compass/sass_compiler.rb b/cli/lib/compass/sass_compiler.rb index 068471b739..588ad54dad 100644 --- a/cli/lib/compass/sass_compiler.rb +++ b/cli/lib/compass/sass_compiler.rb @@ -113,10 +113,11 @@ def when_deleting_sourcemap(filename) def when_compilation_error(error, sass_file, css_file, sourcemap_file) @error_count += 1 if error.respond_to?(:sass_filename) - if relativize(error.sass_filename) == relativize(sass_file) - logger.record :error, "#{relativize(error.sass_filename)} (Line #{error.sass_line}: #{error.message})" + error_filename = error.sass_filename || sass_file + if relativize(error_filename) == relativize(sass_file) + logger.record :error, "#{relativize(sass_file)} (Line #{error.sass_line}: #{error.message})" else - logger.record :error, "#{relativize(sass_file)} (Line #{error.sass_line} of #{relativize(error.sass_filename)}: #{error.message})" + logger.record :error, "#{relativize(sass_file)} (Line #{error.sass_line} of #{relativize(error_filename)}: #{error.message})" end else logger.record :error, "#{relativize(sass_file)} (#{error.backtrace.first}: #{error.message})"