diff --git a/src/document/xml/renderer.c b/src/document/xml/renderer.c index 2c833b68e..731507a9e 100644 --- a/src/document/xml/renderer.c +++ b/src/document/xml/renderer.c @@ -56,9 +56,10 @@ render_source_document_cxx(struct cache_entry *cached, struct document *document xmlpp::Document *docu = document->dom; xmlpp::ustring text = docu->write_to_string_formatted(get_cp_mime_name(document->cp)); struct string tt; - init_string(&tt); - add_bytes_to_string(&tt, text.c_str(), text.size()); - render_plain_document(cached, document, &tt); - done_string(&tt); + if (init_string(&tt)) { + add_bytes_to_string(&tt, text.c_str(), text.size()); + render_plain_document(cached, document, &tt); + done_string(&tt); + } } }