@@ -356,11 +356,16 @@ void QgsIdentifyResults::contextMenuEvent( QContextMenuEvent* event )
356
356
357
357
mActionPopup = new QMenu ();
358
358
359
- mActionPopup ->addAction ( vlayer->isEditable () ? tr ( " Edit feature form" ) : tr ( " View feature form" ), this , SLOT ( featureForm () ) );
360
- mActionPopup ->addAction ( tr ( " Zoom to feature" ), this , SLOT ( zoomToFeature () ) );
361
- mActionPopup ->addAction ( tr ( " Copy attribute value" ), this , SLOT ( copyAttributeValue () ) );
362
- mActionPopup ->addAction ( tr ( " Copy feature attributes" ), this , SLOT ( copyFeatureAttributes () ) );
363
- mActionPopup ->addSeparator ();
359
+ QTreeWidgetItem *featItem = featureItem ( item );
360
+ if ( featItem )
361
+ {
362
+ mActionPopup ->addAction ( vlayer->isEditable () ? tr ( " Edit feature form" ) : tr ( " View feature form" ), this , SLOT ( featureForm () ) );
363
+ mActionPopup ->addAction ( tr ( " Zoom to feature" ), this , SLOT ( zoomToFeature () ) );
364
+ mActionPopup ->addAction ( tr ( " Copy attribute value" ), this , SLOT ( copyAttributeValue () ) );
365
+ mActionPopup ->addAction ( tr ( " Copy feature attributes" ), this , SLOT ( copyFeatureAttributes () ) );
366
+ mActionPopup ->addSeparator ();
367
+ }
368
+
364
369
mActionPopup ->addAction ( tr ( " Clear results" ), this , SLOT ( clear () ) );
365
370
mActionPopup ->addAction ( tr ( " Clear highlights" ), this , SLOT ( clearRubberbands () ) );
366
371
mActionPopup ->addAction ( tr ( " Highlight all" ), this , SLOT ( highlightAll () ) );
@@ -558,6 +563,8 @@ QgsVectorLayer *QgsIdentifyResults::vectorLayer( QTreeWidgetItem *item )
558
563
QTreeWidgetItem *QgsIdentifyResults::retrieveAttributes ( QTreeWidgetItem *item, QList< QPair<QString, QString> > &attributes, int &idx )
559
564
{
560
565
QTreeWidgetItem *featItem = featureItem ( item );
566
+ if ( !featItem )
567
+ return 0 ;
561
568
562
569
idx = -1 ;
563
570
0 commit comments