summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2023-04-10 01:02:49 -0600
committerDan Allen <dan.j.allen@gmail.com>2023-04-10 01:03:27 -0600
commit636f2f8af804a64f7ab91658c51766516ff632cf (patch)
tree31f4515ded65da006025046e912150f29da5914d /lib
parent290bd4c8f252cdc8c2ff1cb141eca66dd6c1929f (diff)
don't crash if source block with custom subs is empty and source highlighter is enabled
Diffstat (limited to 'lib')
-rw-r--r--lib/asciidoctor/pdf/converter.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/asciidoctor/pdf/converter.rb b/lib/asciidoctor/pdf/converter.rb
index c4add9f6..5ce8ae5f 100644
--- a/lib/asciidoctor/pdf/converter.rb
+++ b/lib/asciidoctor/pdf/converter.rb
@@ -1086,8 +1086,9 @@ module Asciidoctor
callouts_enabled = false
end
subs[highlight_idx] = :specialcharacters
+ source_string = node.content || ''
# NOTE: indentation guards will be added by the source highlighter logic
- source_string = expand_tabs unescape_xml (sanitize node.content, compact: false)
+ source_string = expand_tabs unescape_xml (sanitize source_string, compact: false) unless source_string.empty?
node.lines.replace saved_lines if saved_lines
end
else