From 47acc264a0fef0ae59d23ef78b8345d97950ec5e Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 22 Apr 2024 18:35:12 +0300 Subject: NewStory: fix for a crash on a wrongly created html --- plugins/NewStory/src/history_array.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'plugins') diff --git a/plugins/NewStory/src/history_array.cpp b/plugins/NewStory/src/history_array.cpp index 4bedf1b828..b2268f81c2 100644 --- a/plugins/NewStory/src/history_array.cpp +++ b/plugins/NewStory/src/history_array.cpp @@ -214,7 +214,7 @@ int ItemData::calcHeight(int width) } leftOffset = xPos; - if (savedHeight == -1) { + if (m_doc && savedHeight == -1) { m_doc->render(cx); savedHeight = m_doc->height() + 5; } @@ -472,8 +472,9 @@ void ItemData::setText(const wchar_t *pwszText) pOwner->webPage.clText = g_fontTable[fontid].cl; pOwner->webPage.clBack = g_colorTable[colorid].cl; - litehtml::estring body(T2Utf(formatHtml(pwszText)).get(), litehtml::encoding::utf_8); - m_doc = litehtml::document::createFromString(body, &pOwner->webPage); + T2Utf szFormattedBody(formatHtml(pwszText)); + if (szFormattedBody) + m_doc = litehtml::document::createFromString(litehtml::estring(szFormattedBody.get(), litehtml::encoding::utf_8), &pOwner->webPage); } // Array -- cgit v1.2.3