Skip to content

Commit 82764c6

Browse files
author
jef
committedMar 7, 2010

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed
 

‎src/app/qgsidentifyresults.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -356,11 +356,16 @@ void QgsIdentifyResults::contextMenuEvent( QContextMenuEvent* event )
356356

357357
mActionPopup = new QMenu();
358358

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+
364369
mActionPopup->addAction( tr( "Clear results" ), this, SLOT( clear() ) );
365370
mActionPopup->addAction( tr( "Clear highlights" ), this, SLOT( clearRubberbands() ) );
366371
mActionPopup->addAction( tr( "Highlight all" ), this, SLOT( highlightAll() ) );
@@ -558,6 +563,8 @@ QgsVectorLayer *QgsIdentifyResults::vectorLayer( QTreeWidgetItem *item )
558563
QTreeWidgetItem *QgsIdentifyResults::retrieveAttributes( QTreeWidgetItem *item, QList< QPair<QString, QString> > &attributes, int &idx )
559564
{
560565
QTreeWidgetItem *featItem = featureItem( item );
566+
if ( !featItem )
567+
return 0;
561568

562569
idx = -1;
563570

0 commit comments

Comments
 (0)
Please sign in to comment.