diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-10-16 10:47:05 +0100 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-10-16 16:13:30 +0200 |
commit | 2b1aaa84e28d0def9f845deb4c105ea4c7b252c6 (patch) | |
tree | 4d8b71db8fa3cce343b6a109eea63527ad9dd8c7 /vcl | |
parent | 8ff7d75c1929876743b01d9651ea30928673433f (diff) |
check return of get_iter_abs_pos
Change-Id: Ifdabd65dc9fa5bc6d0c5c6eee1318f99bf918cd2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158025
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/jsdialog/executor.cxx | 48 |
1 files changed, 34 insertions, 14 deletions
diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx index 46d5fb675366..7c36eb3bdc1e 100644 --- a/vcl/jsdialog/executor.cxx +++ b/vcl/jsdialog/executor.cxx @@ -467,9 +467,14 @@ bool ExecuteAction(const OUString& nWindowId, const OUString& rWidget, StringMap pTreeView->unselect_all(); std::unique_ptr<weld::TreeIter> itEntry(pTreeView->make_iterator()); - pTreeView->get_iter_abs_pos(*itEntry, nAbsPos); - pTreeView->select(*itEntry); - pTreeView->set_cursor_without_notify(*itEntry); + if (pTreeView->get_iter_abs_pos(*itEntry, nAbsPos)) + { + pTreeView->select(*itEntry); + pTreeView->set_cursor_without_notify(*itEntry); + } + else + SAL_WARN("vcl", + "No absolute position found for " << nAbsPos << " in treeview"); pTreeView->grab_focus(); LOKTrigger::trigger_changed(*pTreeView); return true; @@ -480,9 +485,14 @@ bool ExecuteAction(const OUString& nWindowId, const OUString& rWidget, StringMap pTreeView->unselect_all(); std::unique_ptr<weld::TreeIter> itEntry(pTreeView->make_iterator()); - pTreeView->get_iter_abs_pos(*itEntry, nRow); - pTreeView->select(nRow); - pTreeView->set_cursor_without_notify(*itEntry); + if (pTreeView->get_iter_abs_pos(*itEntry, nRow)) + { + pTreeView->select(nRow); + pTreeView->set_cursor_without_notify(*itEntry); + } + else + SAL_WARN("vcl", + "No absolute position found for " << nRow << " in treeview"); pTreeView->grab_focus(); LOKTrigger::trigger_changed(*pTreeView); LOKTrigger::trigger_row_activated(*pTreeView); @@ -492,20 +502,30 @@ bool ExecuteAction(const OUString& nWindowId, const OUString& rWidget, StringMap { sal_Int32 nAbsPos = o3tl::toInt32(rData["data"]); std::unique_ptr<weld::TreeIter> itEntry(pTreeView->make_iterator()); - pTreeView->get_iter_abs_pos(*itEntry, nAbsPos); - pTreeView->set_cursor_without_notify(*itEntry); - pTreeView->grab_focus(); - pTreeView->expand_row(*itEntry); + if (pTreeView->get_iter_abs_pos(*itEntry, nAbsPos)) + { + pTreeView->set_cursor_without_notify(*itEntry); + pTreeView->grab_focus(); + pTreeView->expand_row(*itEntry); + } + else + SAL_WARN("vcl", + "No absolute position found for " << nAbsPos << " in treeview"); return true; } else if (sAction == "collapse") { sal_Int32 nAbsPos = o3tl::toInt32(rData["data"]); std::unique_ptr<weld::TreeIter> itEntry(pTreeView->make_iterator()); - pTreeView->get_iter_abs_pos(*itEntry, nAbsPos); - pTreeView->set_cursor_without_notify(*itEntry); - pTreeView->grab_focus(); - pTreeView->collapse_row(*itEntry); + if (pTreeView->get_iter_abs_pos(*itEntry, nAbsPos)) + { + pTreeView->set_cursor_without_notify(*itEntry); + pTreeView->grab_focus(); + pTreeView->collapse_row(*itEntry); + } + else + SAL_WARN("vcl", + "No absolute position found for " << nAbsPos << " in treeview"); return true; } else if (sAction == "dragstart") |