Resolves: tdf#148197 crash on launching context menu with no row selected

Change-Id: I4b05e6013ec4fb8f3968484a59c2dacf1e1c97ee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133095
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index c614ee4..64a710b 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -1763,7 +1763,7 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, rCEvt, bool)
        xPop->remove("sort");

    bool bSetSensitiveCollapseAllCategories = false;
    if (!m_bIsRoot)
    if (!m_bIsRoot && xEntry)
    {
        bool bEntry = m_xTreeView->get_iter_first(*xEntry);
        while (bEntry)