cui/source/dialogs/hlmarkwn.cxx |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 83702d53b9a803b31dab9d48c19904724e30f2fd
Author:     Andras Timar <[email protected]>
AuthorDate: Mon Feb 23 18:47:10 2026 +0100
Commit:     Miklos Vajna <[email protected]>
CommitDate: Tue Feb 24 12:11:44 2026 +0100

    cui: fix crash in Hyperlink dialog mark tree with unexpected outline levels
    
    The while loop in FillTree could pop all entries from the stack,
    including the sentinel, if a heading had an outline level <= -1.
    Subsequent top() calls on the empty stack triggered a SIGABRT.
    Keep the sentinel entry by checking stack size before popping.
    
    Change-Id: I647b0de4d39dea4cdad44cc844db4a0788ab91db
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200079
    Reviewed-by: Miklos Vajna <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Moritz Duge <[email protected]>

diff --git a/cui/source/dialogs/hlmarkwn.cxx b/cui/source/dialogs/hlmarkwn.cxx
index f35be2db2aea..ebb50ac4dd89 100644
--- a/cui/source/dialogs/hlmarkwn.cxx
+++ b/cui/source/dialogs/hlmarkwn.cxx
@@ -361,8 +361,9 @@ int SvxHlinkDlgMarkWnd::FillTree( const uno::Reference< 
container::XNameAccess >
                         sal_Int32 nOutlineLevel = 
*o3tl::doAccess<sal_Int32>(aAny);
 
                         // pop until the top of stack entry has an outline 
level less than
-                        // the to be inserted heading outline level
-                        while (nOutlineLevel <= 
aHeadingsParentEntryStack.top().second)
+                        // the to be inserted heading outline level, but keep 
the sentinel
+                        while (aHeadingsParentEntryStack.size() > 1
+                               && nOutlineLevel <= 
aHeadingsParentEntryStack.top().second)
                             aHeadingsParentEntryStack.pop();
 
                         
mxLbTree->insert(aHeadingsParentEntryStack.top().first.get(), -1,

Reply via email to