lib/css_parser/parser.rb in css_parser-1.1.3 vs lib/css_parser/parser.rb in css_parser-1.1.4
- old
+ new
@@ -289,11 +289,14 @@
uri.scheme = 'file'
end
base_uri = uri if base_uri.nil?
src, charset = read_remote_file(uri)
- add_block!(src, {:media_types => media_types, :base_uri => base_uri})
+
+ if src
+ add_block!(src, {:media_types => media_types, :base_uri => base_uri})
+ end
end
# Load a local CSS file.
def load_file!(file_name, base_dir = nil, media_types = :all)
file_name = File.expand_path(file_name, base_dir)
@@ -379,9 +382,10 @@
ic = Iconv.new('UTF-8//IGNORE', charset)
src = ic.iconv(src)
end
rescue
raise RemoteFileError if @options[:io_exceptions]
+ return nil, nil
end
return src, charset
end