summaryrefslogtreecommitdiff
path: root/plugins/NewStory/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-04-22 18:35:12 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-04-22 18:35:12 +0300
commit47acc264a0fef0ae59d23ef78b8345d97950ec5e (patch)
tree115ef91d499539bc51d11534ce663cfed841196a /plugins/NewStory/src
parent9fe7160a419e7d3c5380ced77c3548a87f5b814b (diff)
NewStory: fix for a crash on a wrongly created html
Diffstat (limited to 'plugins/NewStory/src')
-rw-r--r--plugins/NewStory/src/history_array.cpp7
1 files changed, 4 insertions, 3 deletions
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