Kaydet (Commit) d78b81b3 authored tarafından Bjoern Michaelsen's avatar Bjoern Michaelsen Kaydeden (comit) Michael Meeks

tdf#92308: Dont crash on "File > Send > Email Document"

- crashed due to out-of-range index with empty vector
- kill pruposeless manual index fiddling for good
- add trivial test

Change-Id: Ic224c70f432d2b26718e05aa5a2742461cfb7bec
Reviewed-on: https://gerrit.libreoffice.org/16749Reviewed-by: 's avatarMichael Meeks <michael.meeks@collabora.com>
Tested-by: 's avatarMichael Meeks <michael.meeks@collabora.com>
üst 860f983e
...@@ -109,6 +109,7 @@ public: ...@@ -109,6 +109,7 @@ public:
void testFormulas(); void testFormulas();
void testIntrusiveRing(); void testIntrusiveRing();
void testClientModify(); void testClientModify();
void testTdf92308();
CPPUNIT_TEST_SUITE(SwDocTest); CPPUNIT_TEST_SUITE(SwDocTest);
...@@ -141,6 +142,7 @@ public: ...@@ -141,6 +142,7 @@ public:
CPPUNIT_TEST(testFormulas); CPPUNIT_TEST(testFormulas);
CPPUNIT_TEST(testIntrusiveRing); CPPUNIT_TEST(testIntrusiveRing);
CPPUNIT_TEST(testClientModify); CPPUNIT_TEST(testClientModify);
CPPUNIT_TEST(testTdf92308);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
private: private:
...@@ -1565,6 +1567,11 @@ void SwDocTest::testClientModify() ...@@ -1565,6 +1567,11 @@ void SwDocTest::testClientModify()
CPPUNIT_ASSERT_EQUAL(aClient2.m_nNotifyCount,1); CPPUNIT_ASSERT_EQUAL(aClient2.m_nNotifyCount,1);
} }
void SwDocTest::testTdf92308()
{
CPPUNIT_ASSERT_EQUAL(m_pDoc->HasInvisibleContent(), false);
}
void SwDocTest::setUp() void SwDocTest::setUp()
{ {
BootstrapFixture::setUp(); BootstrapFixture::setUp();
......
...@@ -1453,10 +1453,8 @@ bool SwDoc::HasInvisibleContent() const ...@@ -1453,10 +1453,8 @@ bool SwDoc::HasInvisibleContent() const
} }
} }
const SwSectionFormats& rSectFormats = GetSections(); for(auto pSectFormat : GetSections())
for( SwSectionFormats::size_type n = rSectFormats.size()-1; n; --n )
{ {
SwSectionFormat* pSectFormat = rSectFormats[ n ];
// don't add sections in Undo/Redo // don't add sections in Undo/Redo
if( !pSectFormat->IsInNodesArr()) if( !pSectFormat->IsInNodesArr())
continue; continue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment