diff options
author | Louise Crow <louise.crow@gmail.com> | 2015-04-02 10:16:52 +0100 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2015-04-02 10:21:48 +0100 |
commit | d60430da5d407db137c8ec0b73cc31cbf29837c3 (patch) | |
tree | a1e188bb4265720f3dbfc3db4cd6e5cc7bf44895 /lib/attachment_to_html | |
parent | 188df36f1b746b9864250bea82a5dd7704cbf4ac (diff) |
Handle the expected case where conversion fails and returns nil.
Diffstat (limited to 'lib/attachment_to_html')
-rw-r--r-- | lib/attachment_to_html/adapters/pdf.rb | 3 |
1 files changed, 2 insertions, 1 deletions
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[^>]*>(.*?)<\/body>/mi) + conversion = convert + match = conversion ? conversion.match(/<body[^>]*>(.*?)<\/body>/mi) : nil match ? match[1] : '' end |