summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-11-25 17:29:09 +0100
committerStephan Bergmann <sbergman@redhat.com>2016-11-25 17:29:09 +0100
commit8b718e3774f1ffb69f9aad565216556c798e95f4 (patch)
tree35741e1f606ccf98b25f0d5c577da2d99fb2d442
parent086631af59636cd9a6a45b747a1bc59b4b547794 (diff)
Handle cases where last-used palette disappeared
...so PaletteManager::SetPalette(LISTBOX_ENTRY_NOTFOUND) would set PaletteManager::mnCurrentPalette to 65535, and PaletteManager::GetSelectedPalettePath would do out-of-bounds access into PaletteManage::m_Palettes. That the last-used palette (as stored under in the configuration under /org.openoffice.Office.Common/UserColors/PaletteName) may become more common with pending changes like <https://gerrit.libreoffice.org/#/c/31199/> "tdf#104047 Remove dispensable palettes". Change-Id: I5641bae04f50fea8aa69027a75de08c22394c281
-rw-r--r--cui/source/tabpages/tpcolor.cxx6
-rw-r--r--svx/source/tbxctrls/tbcontrl.cxx5
2 files changed, 8 insertions, 3 deletions
diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx
index c31f57fce3f8..e4545b497d6e 100644
--- a/cui/source/tabpages/tpcolor.cxx
+++ b/cui/source/tabpages/tpcolor.cxx
@@ -220,7 +220,10 @@ void SvxColorTabPage::FillPaletteLB()
}
OUString aPaletteName( officecfg::Office::Common::UserColors::PaletteName::get() );
m_pSelectPalette->SelectEntry(aPaletteName);
- SelectPaletteLBHdl( *m_pSelectPalette );
+ if (m_pSelectPalette->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND)
+ {
+ SelectPaletteLBHdl( *m_pSelectPalette );
+ }
}
void SvxColorTabPage::Construct()
@@ -228,7 +231,6 @@ void SvxColorTabPage::Construct()
if (pColorList.is())
{
FillPaletteLB();
- SelectPaletteLBHdl( *m_pSelectPalette );
ImpColorCountChanged();
}
}
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 48551590a396..d2252e64a3e1 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -1356,7 +1356,10 @@ SvxColorWindow::SvxColorWindow(const OUString& rCommand,
}
OUString aPaletteName( officecfg::Office::Common::UserColors::PaletteName::get() );
mpPaletteListBox->SelectEntry( aPaletteName );
- SelectPaletteHdl( *mpPaletteListBox );
+ if (mpPaletteListBox->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND)
+ {
+ SelectPaletteHdl( *mpPaletteListBox );
+ }
mpButtonAutoColor->SetClickHdl( LINK( this, SvxColorWindow, AutoColorClickHdl ) );
mpButtonNoneColor->SetClickHdl( LINK( this, SvxColorWindow, AutoColorClickHdl ) );