From d60430da5d407db137c8ec0b73cc31cbf29837c3 Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Thu, 2 Apr 2015 10:16:52 +0100 Subject: Handle the expected case where conversion fails and returns nil. --- lib/attachment_to_html/adapters/pdf.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/attachment_to_html') diff --git a/lib/attachment_to_html/adapters/pdf.rb b/lib/attachment_to_html/adapters/pdf.rb index 3183d1fd0..3c18e9d4a 100644 --- a/lib/attachment_to_html/adapters/pdf.rb +++ b/lib/attachment_to_html/adapters/pdf.rb @@ -42,7 +42,8 @@ module AttachmentToHTML private def parse_body - match = convert.match(/]*>(.*?)<\/body>/mi) + conversion = convert + match = conversion ? conversion.match(/]*>(.*?)<\/body>/mi) : nil match ? match[1] : '' end -- cgit v1.2.3