From cd1193bf3880bc662d688b300d367d2e0cbd80a5 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Tue, 4 Jan 2022 16:34:02 +0100 Subject: [PATCH] [string] Check for NULL. --- src/document/xml/renderer.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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); + } } }