diff options
author | Michael Stahl <mstahl@redhat.com> | 2012-10-14 21:10:38 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-10-14 21:14:25 +0200 |
commit | 3d1f4649ee72dd85e1d994ac2bdccc3147830bbd (patch) | |
tree | c74d2babd65a26f364db5e0262fff2c1c2f28c55 /svx | |
parent | 86b6bf6e53c234e3df951ebb08513b0d4fc47a14 (diff) |
FontPrevWin_Impl::CheckScript(): assert that there is text:
If there is no preview text here then aTextWidth will have no entries
and we crash when writing to the non-existing first element.
aText should come from the current SfxViewShell, from the font name
(unless that is ambiguous, e.g. a selection of text with multiple
fonts), or the Window text (Window::GetText(), whatever that is).
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/dialog/fntctrl.cxx | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/svx/source/dialog/fntctrl.cxx b/svx/source/dialog/fntctrl.cxx index c09f3bfc3fac..cc775a58e55d 100644 --- a/svx/source/dialog/fntctrl.cxx +++ b/svx/source/dialog/fntctrl.cxx @@ -176,7 +176,6 @@ class FontPrevWin_Impl bool m_bCTLEnabled; - void _CheckScript(); public: inline FontPrevWin_Impl() : pPrinter( NULL ), bDelPrinter( sal_False ), @@ -213,12 +212,6 @@ public: // sets the 100%-Font-Widths }; -void FontPrevWin_Impl::CheckScript() -{ - if( aText != aScriptText ) - _CheckScript(); -} - inline void FontPrevWin_Impl::Invalidate100PercentFontWidth() { n100PercentFontWidth = n100PercentFontWidthCJK = n100PercentFontWidthCTL = -1; @@ -237,15 +230,19 @@ inline sal_Bool FontPrevWin_Impl::Is100PercentFontWidthValid() const // class FontPrevWin_Impl ----------------------------------------------- /* - * void FontPrevWin_Impl::_CheckScript() * evalutates the scripttypes of the actual string. * Afterwards the positions of script change are notified in aScriptChg, * the scripttypes in aScriptType. * The aTextWidth array will be filled with zero. */ - -void FontPrevWin_Impl::_CheckScript() +void FontPrevWin_Impl::CheckScript() { + assert(aText.Len()); // must have a preview text here! + if (aText == aScriptText) + { + return; // already initialized + } + aScriptText = aText; aScriptChg.clear(); @@ -258,6 +255,7 @@ void FontPrevWin_Impl::_CheckScript() xBreak = Reference< XBreakIterator >(xMSF->createInstance( ::rtl::OUString("com.sun.star.i18n.BreakIterator") ),UNO_QUERY); } + assert(xBreak.is()); // no can do without breakiter if( xBreak.is() ) { sal_uInt16 nScript = xBreak->getScriptType( aText, 0 ); |