[Libreoffice-commits] core.git: sw/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri Mar 27 09:59:55 UTC 2020


 sw/source/ui/misc/glossary.cxx |   30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

New commits:
commit e778b72fe616badf400960e0459ee661e535bd45
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Mar 27 09:16:25 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Mar 27 10:59:19 2020 +0100

    cid#1460974 Unchecked return value
    
    Change-Id: Ie5b9d9d074ec19ab6f8b08cd9959680677925cf7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91193
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx
index d0d099da0782..aaeaa0b89e9e 100644
--- a/sw/source/ui/misc/glossary.cxx
+++ b/sw/source/ui/misc/glossary.cxx
@@ -502,25 +502,27 @@ IMPL_LINK(SwGlossaryDlg, MenuHdl, const OString&, rItemIdent, void)
         m_xShortNameEdit->set_text(m_pGlossaryHdl->GetGlossaryShortName(m_xNameED->get_text()));
         SwNewGlosNameDlg aNewNameDlg(this, m_xNameED->get_text(), m_xShortNameEdit->get_text());
         if (aNewNameDlg.run() == RET_OK && m_pGlossaryHdl->Rename(m_xShortNameEdit->get_text(),
-                                                                aNewNameDlg.GetNewShort(),
-                                                                aNewNameDlg.GetNewName()))
+                                                                  aNewNameDlg.GetNewShort(),
+                                                                  aNewNameDlg.GetNewName()))
         {
             std::unique_ptr<weld::TreeIter> xEntry = m_xCategoryBox->make_iterator();
-            m_xCategoryBox->get_selected(xEntry.get());
-            std::unique_ptr<weld::TreeIter> xOldEntry = m_xCategoryBox->make_iterator(xEntry.get());
-            if (m_xCategoryBox->get_iter_depth(*xEntry))
-                m_xCategoryBox->iter_parent(*xEntry);
+            if (m_xCategoryBox->get_selected(xEntry.get()))
+            {
+                std::unique_ptr<weld::TreeIter> xOldEntry = m_xCategoryBox->make_iterator(xEntry.get());
+                if (m_xCategoryBox->get_iter_depth(*xEntry))
+                    m_xCategoryBox->iter_parent(*xEntry);
 
-            std::unique_ptr<weld::TreeIter> xNewEntry = m_xCategoryBox->make_iterator();
-            OUString sId(aNewNameDlg.GetNewShort());
-            OUString sName(aNewNameDlg.GetNewName());
+                std::unique_ptr<weld::TreeIter> xNewEntry = m_xCategoryBox->make_iterator();
+                OUString sId(aNewNameDlg.GetNewShort());
+                OUString sName(aNewNameDlg.GetNewName());
 
-            m_xCategoryBox->insert(xEntry.get(), -1, &sName, &sId,
-                                   nullptr, nullptr, nullptr, false, xNewEntry.get());
+                m_xCategoryBox->insert(xEntry.get(), -1, &sName, &sId,
+                                       nullptr, nullptr, nullptr, false, xNewEntry.get());
 
-            m_xCategoryBox->remove(*xOldEntry);
-            m_xCategoryBox->select(*xNewEntry);
-            m_xCategoryBox->scroll_to_row(*xNewEntry);
+                m_xCategoryBox->remove(*xOldEntry);
+                m_xCategoryBox->select(*xNewEntry);
+                m_xCategoryBox->scroll_to_row(*xNewEntry);
+            }
         }
         GrpSelect(*m_xCategoryBox);
     }


More information about the Libreoffice-commits mailing list