diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-11-16 14:47:49 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-11-16 21:18:09 +0100 |
commit | b92d1d509a1db2179779a4776590734590290a41 (patch) | |
tree | c24da8bf9fa6f17b5a17f9a1d42f1c0550931e5e /cui | |
parent | 61560ae7d6f00ba6b410f7779e9a46cf692a5400 (diff) |
tdf#137403 ignore GetCurCommand if its empty
Change-Id: I63cc33c33d36d53d882aae72b8f480ea9842e1b5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105945
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/customize/acccfg.cxx | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx index 5fc6a95dd4fe..014c8b09f328 100644 --- a/cui/source/customize/acccfg.cxx +++ b/cui/source/customize/acccfg.cxx @@ -1206,7 +1206,7 @@ IMPL_LINK(SfxAcceleratorConfigPage, SelectHdl, weld::TreeView&, rListBox, void) m_xRemoveButton->set_sensitive(false); m_xChangeButton->set_sensitive(false); - // #i36994 First selected can return zero! + // #i36994 First selected can return null! TAccInfo* pEntry = reinterpret_cast<TAccInfo*>(m_xEntriesBox->get_selected_id().toInt64()); if (pEntry) { @@ -1216,19 +1216,23 @@ IMPL_LINK(SfxAcceleratorConfigPage, SelectHdl, weld::TreeView&, rListBox, void) { if (pEntry->isConfigured()) m_xRemoveButton->set_sensitive(true); - m_xChangeButton->set_sensitive(pEntry->m_sCommand != sPossibleNewCommand); + m_xChangeButton->set_sensitive(pEntry->m_sCommand != sPossibleNewCommand + && !sPossibleNewCommand.isEmpty()); } // update key box m_xKeyBox->clear(); - for (int i = 0, nCount = m_xEntriesBox->n_children(); i < nCount; ++i) + if (!sPossibleNewCommand.isEmpty()) { - TAccInfo* pUserData - = reinterpret_cast<TAccInfo*>(m_xEntriesBox->get_id(i).toInt64()); - if (pUserData && pUserData->m_sCommand == sPossibleNewCommand) + for (int i = 0, nCount = m_xEntriesBox->n_children(); i < nCount; ++i) { - m_xKeyBox->append(OUString::number(reinterpret_cast<sal_Int64>(pUserData)), - pUserData->m_aKey.GetName()); + TAccInfo* pUserData + = reinterpret_cast<TAccInfo*>(m_xEntriesBox->get_id(i).toInt64()); + if (pUserData && pUserData->m_sCommand == sPossibleNewCommand) + { + m_xKeyBox->append(OUString::number(reinterpret_cast<sal_Int64>(pUserData)), + pUserData->m_aKey.GetName()); + } } } } |