cid#1676285 Improper use of negative value

and

cid#1676283 Argument cannot be negative

Change-Id: I0096d15eb76f1e481a5c3a3ea8f69385c8eed93a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196109
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
This commit is contained in:
Caolán McNamara
2025-12-22 22:25:36 +01:00
parent 180df83664
commit 8ff76955c6
2 changed files with 7 additions and 1 deletions
@@ -121,7 +121,7 @@ IMPL_LINK_NOARG(SwCustomizeAddressListDialog, DeleteHdl_Impl, weld::Button&, voi
IMPL_LINK(SwCustomizeAddressListDialog, UpDownHdl_Impl, weld::Button&, rButton, void)
{
auto nPos = m_xFieldsLB->get_selected_index();
assert(nPos && "nothing selected");
assert(nPos != -1 && "nothing selected");
auto nOldPos = nPos;
OUString aTemp = m_xFieldsLB->get_text(nPos);
m_xFieldsLB->remove(nPos);
+6
View File
@@ -398,6 +398,12 @@ void SwGlobalTree::MoveSelectionTo(const weld::TreeIter* pDropEntry)
{
int nSource = m_xTreeView->get_selected_index();
if (nSource == -1)
{
SAL_WARN("sw", "No selection to move");
return;
}
int nDest = pDropEntry ? m_xTreeView->get_iter_index_in_parent(*pDropEntry)
: m_pSwGlblDocContents->size();