summaryrefslogtreecommitdiff
path: root/svtools/source/control/stdmenu.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-04-04 20:35:06 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-04-04 20:58:27 +0100
commit0d46e05cf26ee14793b50a00dbd64ffc68bc8435 (patch)
tree87468158de0438b08f8d41bf58e981b34e6a9f4e /svtools/source/control/stdmenu.cxx
parent8aa12e6e62341698dadacbc7af75f14ed17d1b1d (diff)
coverity#704828 Explicit null dereferenced
Change-Id: I5e27241334cfeb4dffecbbf1d010abe94fbc52df
Diffstat (limited to 'svtools/source/control/stdmenu.cxx')
-rw-r--r--svtools/source/control/stdmenu.cxx33
1 files changed, 18 insertions, 15 deletions
diff --git a/svtools/source/control/stdmenu.cxx b/svtools/source/control/stdmenu.cxx
index 3faca9ca7a8e..af3546af00c9 100644
--- a/svtools/source/control/stdmenu.cxx
+++ b/svtools/source/control/stdmenu.cxx
@@ -64,24 +64,27 @@ void FontNameMenu::Fill( const FontList* pList )
Clear();
// add fonts
- const vcl::I18nHelper& rI18nHelper = Application::GetSettings().GetUILocaleI18nHelper();
- // more than 100 fonts reduces the speed of opening the menu.
- // So only the first 100 fonts will be displayed.
- sal_uInt16 nFontCount = ::std::min( pList->GetFontNameCount(), static_cast< sal_uInt16 >(100) );
- for (sal_uInt16 i = 0; i < nFontCount; ++i)
+ if (pList)
{
- const OUString& rName = pList->GetFontName( i ).GetName();
-
- // sort with the I18nHelper
- sal_uInt16 j = GetItemCount();
- while ( j )
+ const vcl::I18nHelper& rI18nHelper = Application::GetSettings().GetUILocaleI18nHelper();
+ // more than 100 fonts reduces the speed of opening the menu.
+ // So only the first 100 fonts will be displayed.
+ sal_uInt16 nFontCount = ::std::min( pList->GetFontNameCount(), static_cast< sal_uInt16 >(100) );
+ for (sal_uInt16 i = 0; i < nFontCount; ++i)
{
- OUString aText = GetItemText( GetItemId( j-1 ) );
- if ( rI18nHelper.CompareString( rName, aText ) > 0 )
- break;
- j--;
+ const OUString& rName = pList->GetFontName( i ).GetName();
+
+ // sort with the I18nHelper
+ sal_uInt16 j = GetItemCount();
+ while ( j )
+ {
+ OUString aText = GetItemText( GetItemId( j-1 ) );
+ if ( rI18nHelper.CompareString( rName, aText ) > 0 )
+ break;
+ j--;
+ }
+ InsertItem( i+1, rName, MIB_RADIOCHECK | MIB_AUTOCHECK, OString(), j );
}
- InsertItem( i+1, rName, MIB_RADIOCHECK | MIB_AUTOCHECK, OString(), j );
}
SetCurName( maCurName );