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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu Jul 9 11:00:55 UTC 2020


 svx/source/form/datanavi.cxx |   36 ++++++++++++++++++++++++++++++------
 1 file changed, 30 insertions(+), 6 deletions(-)

New commits:
commit 9ff9ad072e4e38e55b75f5b05d40b72c58e47a28
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Jul 9 10:02:25 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Jul 9 13:00:05 2020 +0200

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

diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx
index ab8ff5c35007..fc7d8fe26652 100644
--- a/svx/source/form/datanavi.cxx
+++ b/svx/source/form/datanavi.cxx
@@ -788,7 +788,11 @@ namespace svxform
             try
             {
                 std::unique_ptr<weld::TreeIter> xEntry(m_xItemList->make_iterator());
-                m_xItemList->get_selected(xEntry.get());
+                if (!m_xItemList->get_selected(xEntry.get()))
+                {
+                    SAL_WARN( "svx.form", "corrupt tree" );
+                    return;
+                }
 
                 // #i36262# may be called for submission entry *or* for
                 // submission children. If we don't have any children, we
@@ -801,24 +805,44 @@ namespace svxform
 
                 _rEntry->getPropertyValue( PN_SUBMISSION_BIND ) >>= sTemp;
                 OUString sEntry = SvxResId( RID_STR_DATANAV_SUBM_BIND ) + sTemp;
-                m_xItemList->iter_children(*xEntry);
+                if (!m_xItemList->iter_children(*xEntry))
+                {
+                    SAL_WARN( "svx.form", "corrupt tree" );
+                    return;
+                }
                 m_xItemList->set_text(*xEntry, sEntry);
                 _rEntry->getPropertyValue( PN_SUBMISSION_REF ) >>= sTemp;
                 sEntry = SvxResId( RID_STR_DATANAV_SUBM_REF ) + sTemp;
-                m_xItemList->iter_next_sibling(*xEntry);
+                if (!m_xItemList->iter_next_sibling(*xEntry))
+                {
+                    SAL_WARN( "svx.form", "corrupt tree" );
+                    return;
+                }
                 m_xItemList->set_text(*xEntry, sEntry);
                 _rEntry->getPropertyValue( PN_SUBMISSION_ACTION ) >>= sTemp;
                 sEntry = SvxResId( RID_STR_DATANAV_SUBM_ACTION ) + sTemp;
-                m_xItemList->iter_next_sibling(*xEntry);
+                if (!m_xItemList->iter_next_sibling(*xEntry))
+                {
+                    SAL_WARN( "svx.form", "corrupt tree" );
+                    return;
+                }
                 _rEntry->getPropertyValue( PN_SUBMISSION_METHOD ) >>= sTemp;
                 sEntry = SvxResId( RID_STR_DATANAV_SUBM_METHOD ) +
                     m_aMethodString.toUI( sTemp );
-                m_xItemList->iter_next_sibling(*xEntry);
+                if (!m_xItemList->iter_next_sibling(*xEntry))
+                {
+                    SAL_WARN( "svx.form", "corrupt tree" );
+                    return;
+                }
                 m_xItemList->set_text(*xEntry, sEntry);
                 _rEntry->getPropertyValue( PN_SUBMISSION_REPLACE ) >>= sTemp;
                 sEntry = SvxResId( RID_STR_DATANAV_SUBM_REPLACE ) +
                     m_aReplaceString.toUI( sTemp );
-                m_xItemList->iter_next_sibling(*xEntry);
+                if (!m_xItemList->iter_next_sibling(*xEntry))
+                {
+                    SAL_WARN( "svx.form", "corrupt tree" );
+                    return;
+                }
                 m_xItemList->set_text(*xEntry, sEntry);
             }
             catch ( Exception const & )


More information about the Libreoffice-commits mailing list