diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2015-07-03 22:08:49 +0200 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-07-03 20:58:53 +0000 |
commit | d78b81b379333bd471c670bc9f49304f1d6f030a (patch) | |
tree | be8cce50734a4baeb6f41eda3f95b05c75661051 | |
parent | 860f983e8982a66cfe2e896604c3dcc40a608f9c (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
Reviewed-on: https://gerrit.libreoffice.org/16749
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
-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 966a2aa23bbf..6cea3ba81c13 100644 --- a/sw/qa/core/uwriter.cxx +++ b/sw/qa/core/uwriter.cxx @@ -109,6 +109,7 @@ public: void testFormulas(); void testIntrusiveRing(); void testClientModify(); + void testTdf92308(); CPPUNIT_TEST_SUITE(SwDocTest); @@ -141,6 +142,7 @@ public: CPPUNIT_TEST(testFormulas); CPPUNIT_TEST(testIntrusiveRing); CPPUNIT_TEST(testClientModify); + CPPUNIT_TEST(testTdf92308); CPPUNIT_TEST_SUITE_END(); private: @@ -1565,6 +1567,11 @@ void SwDocTest::testClientModify() CPPUNIT_ASSERT_EQUAL(aClient2.m_nNotifyCount,1); } +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 f1880db1d6ae..2b82850d87b4 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -1453,10 +1453,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; |