diff --git a/lib/prawn/svg/document.rb b/lib/prawn/svg/document.rb index b2696cb..0229bcb 100644 --- a/lib/prawn/svg/document.rb +++ b/lib/prawn/svg/document.rb @@ -17,7 +17,11 @@ class Prawn::SVG::Document :color_mode def initialize(data, bounds, options, font_registry: nil, css_parser: CssParser::Parser.new, attribute_overrides: {}) - @root = REXML::Document.new(data).root + begin + @root = REXML::Document.new(data).root + rescue REXML::ParseException + @root = nil + end if @root.nil? if data.respond_to?(:end_with?) && data.end_with?('.svg')