]> sigrok.org Git - pulseview.git/commitdiff
Header: Handle RowItems that do not create a context menu
authorJoel Holdsworth <redacted>
Sat, 1 Nov 2014 10:05:32 +0000 (10:05 +0000)
committerJoel Holdsworth <redacted>
Wed, 19 Nov 2014 10:23:02 +0000 (10:23 +0000)
pv/view/header.cpp

index 8377cb2cfc481e76d932b68c47e35cc14bd5edec..fdfd896f2ac877339412ed415722cb5789101ba7 100644 (file)
@@ -268,9 +268,14 @@ void Header::leaveEvent(QEvent*)
 void Header::contextMenuEvent(QContextMenuEvent *event)
 {
        const shared_ptr<RowItem> r = get_mouse_over_row_item(_mouse_point);
+       if (!r)
+               return;
+
+       QMenu *const menu = r->create_context_menu(this);
+       if (!menu)
+               return;
 
-       if (r)
-               r->create_context_menu(this)->exec(event->globalPos());
+       menu->exec(event->globalPos());
 }
 
 void Header::keyPressEvent(QKeyEvent *e)