diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2015-07-03 22:08:49 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2015-07-03 22:12:58 +0200 |
commit | 6cadfe0f07659235c6438c345d501eca89b411d5 (patch) | |
tree | d81626419d02940109e4d4c5d6ba6c53d84bf0f2 | |
parent | 53e7011084e6f03bf2e9dc6ccccf8e1f45224707 (diff) |
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
-rw-r--r-- | sw/qa/core/uwriter.cxx | 7 | ||||
-rw-r--r-- | sw/source/core/doc/doc.cxx | 4 |
2 files changed, 8 insertions, 3 deletions
diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx index e312d5c4efe8..b74dbea7273f 100644 --- a/sw/qa/core/uwriter.cxx +++ b/sw/qa/core/uwriter.cxx @@ -111,6 +111,7 @@ public: void testIntrusiveRing(); void testClientModify(); void test64kPageDescs(); + void testTdf92308(); CPPUNIT_TEST_SUITE(SwDocTest); @@ -144,6 +145,7 @@ public: CPPUNIT_TEST(testIntrusiveRing); CPPUNIT_TEST(testClientModify); CPPUNIT_TEST(test64kPageDescs); + CPPUNIT_TEST(testTdf92308); CPPUNIT_TEST_SUITE_END(); private: @@ -1615,6 +1617,11 @@ void SwDocTest::test64kPageDescs() CPPUNIT_ASSERT( nPos == 0 ); } +void SwDocTest::testTdf92308() +{ + CPPUNIT_ASSERT_EQUAL(m_pDoc->HasInvisibleContent(), false); +} + void SwDocTest::setUp() { BootstrapFixture::setUp(); diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 75e1b3255929..61fe58993e3b 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -1450,10 +1450,8 @@ bool SwDoc::HasInvisibleContent() const } } - const SwSectionFormats& rSectFormats = GetSections(); - for( SwSectionFormats::size_type n = rSectFormats.size()-1; n; --n ) + for(auto pSectFormat : GetSections()) { - SwSectionFormat* pSectFormat = rSectFormats[ n ]; // don't add sections in Undo/Redo if( !pSectFormat->IsInNodesArr()) continue; |