fix crash when push the Bullets button on the toolbar and then press the
dropdown part of the button
caused by commit I40cfc39501006146f7c6c04a1f3c7cf877c6f1c4
(tdf#161056 Show bullets used in document in bullets dropdown)
Change-Id: I215d7cb677825821917a4fd8c498deaaab9fc9b8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167838
Tested-by: Jenkins
Reviewed-by: Nagy Tibor <tibor.nagy.extern@allotropia.de>
diff --git a/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py b/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py
index b3c5484..abf090f 100644
--- a/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py
+++ b/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py
@@ -259,4 +259,11 @@ class formatBulletsNumbering(UITestCase):
self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "73")
def test_bullets_and_numbering_document_bullet_list(self):
with self.ui_test.create_doc_in_start_center("writer"):
self.xUITest.executeCommand(".uno:DefaultBullet")
# Without the fix in place, this test would have crashed here
self.xUITest.executeCommand(".uno:DocumentBulletList")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index adf0f5b..c4afeac 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -2534,8 +2534,11 @@ std::vector<OUString> SwDoc::GetUsedBullets()
for (int nLevel=0; nLevel<10; ++nLevel)
{
const SwNumFormat& rFormat = (*mpNumRuleTable)[nRule]->Get(nLevel);
if (SVX_NUM_CHAR_SPECIAL != rFormat.GetNumberingType())
if (SVX_NUM_CHAR_SPECIAL != rFormat.GetNumberingType()
|| !rFormat.GetBulletFont().has_value())
{
continue;
}
vcl::Font aFont(*rFormat.GetBulletFont());
sal_UCS4 cBullet = rFormat.GetBulletChar();
OUString sBullet(&cBullet, 1);