summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dbaccess/source/ui/querydesign/ConnectionLine.cxx15
1 files changed, 11 insertions, 4 deletions
diff --git a/dbaccess/source/ui/querydesign/ConnectionLine.cxx b/dbaccess/source/ui/querydesign/ConnectionLine.cxx
index 791f89247a52..5411e22e9457 100644
--- a/dbaccess/source/ui/querydesign/ConnectionLine.cxx
+++ b/dbaccess/source/ui/querydesign/ConnectionLine.cxx
@@ -82,13 +82,20 @@ namespace
{
const OTableWindowListBox* pListBox = _pWin->GetListBox();
_rNewConPos.setY( _pWin->GetPosPixel().Y() );
+
+ std::unique_ptr<weld::TreeIter> xEntry;
+ const weld::TreeView& rTreeView = pListBox->get_widget();
+
if (_nEntry != -1)
{
_rNewConPos.AdjustY(pListBox->GetPosPixel().Y() );
- const weld::TreeView& rTreeView = pListBox->get_widget();
- std::unique_ptr<weld::TreeIter> xEntry = rTreeView.make_iterator();
- rTreeView.get_iter_first(*xEntry);
- rTreeView.iter_nth_sibling(*xEntry, _nEntry);
+ xEntry = rTreeView.make_iterator();
+ if (!rTreeView.get_iter_first(*xEntry) || !rTreeView.iter_nth_sibling(*xEntry, _nEntry))
+ xEntry.reset();
+ }
+
+ if (xEntry)
+ {
auto nEntryPos = rTreeView.get_row_area(*xEntry).Center().Y();
if( nEntryPos >= 0 )