mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
desktop: fix crash when right-clicking of trip headers
Commit e42fc1a1e9
introduced a
crash condition. Apparently the code attempts to test whether
the clicked-on item is a top-level dive. The "Collapse others"
menu item should not be shown in that case. It does this by
testing "d->divetrip". However, "d" might quite logically be
null if clicking on an unexpanded trip header.
Therefore, check explicitly for the trip header case (which
should show the menu item) and for good measure prevent
the nullpointer access (that should be caught by testing
for trip, but who knows).
Fixes #3301.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
f308a6b57b
commit
67769235e7
1 changed files with 1 additions and 1 deletions
|
@ -779,7 +779,7 @@ void DiveListView::contextMenuEvent(QContextMenuEvent *event)
|
|||
popup.addAction(tr("Collapse all"), this, &QTreeView::collapseAll);
|
||||
|
||||
// verify if there`s a need for collapse others
|
||||
if (expanded_nodes > 1 && d->divetrip)
|
||||
if (expanded_nodes > 1 && (trip || (d && d->divetrip)))
|
||||
collapseAction = popup.addAction(tr("Collapse others"), this, &QTreeView::collapseAll);
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue