Navigation Menu

Skip to content

Commit

Permalink
Fix #7835, opening WMS layer properties causes crash
Browse files Browse the repository at this point in the history
  • Loading branch information
dakcarto committed May 17, 2013
1 parent ec6a64f commit ce49b66
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/gui/qgsoptionsdialogbase.cpp
Expand Up @@ -96,9 +96,9 @@ void QgsOptionsDialogBase::restoreOptionsBaseUi()
mOptSplitter->restoreState( settings.value( QString( "/Windows/%1/splitState" ).arg( mOptsKey ) ).toByteArray() ); mOptSplitter->restoreState( settings.value( QString( "/Windows/%1/splitState" ).arg( mOptsKey ) ).toByteArray() );
int curIndx = settings.value( QString( "/Windows/%1/tab" ).arg( mOptsKey ), 0 ).toInt(); int curIndx = settings.value( QString( "/Windows/%1/tab" ).arg( mOptsKey ), 0 ).toInt();


// if the last used tab is not enabled, or is missing, display the first enabled one // if the last used tab is out of range or not enabled display the first enabled one
if ( !mOptStackedWidget->widget( curIndx )->isEnabled() if ( mOptStackedWidget->count() < ( curIndx + 1 )
|| mOptStackedWidget->count() < ( curIndx + 1 ) ) || !mOptStackedWidget->widget( curIndx )->isEnabled() )
{ {
curIndx = 0; curIndx = 0;
for ( int i = 0; i < mOptStackedWidget->count(); i++ ) for ( int i = 0; i < mOptStackedWidget->count(); i++ )
Expand All @@ -109,11 +109,13 @@ void QgsOptionsDialogBase::restoreOptionsBaseUi()
break; break;
} }
} }
curIndx = -1; // default fallback
} }


mOptStackedWidget->setCurrentIndex( curIndx ); if ( mOptStackedWidget->count() != 0 && mOptListWidget->count() != 0 )
mOptListWidget->setCurrentRow( curIndx ); {
mOptStackedWidget->setCurrentIndex( curIndx );
mOptListWidget->setCurrentRow( curIndx );
}


// get rid of annoying outer focus rect on Mac // get rid of annoying outer focus rect on Mac
mOptListWidget->setAttribute( Qt::WA_MacShowFocusRect, false ); mOptListWidget->setAttribute( Qt::WA_MacShowFocusRect, false );
Expand Down

0 comments on commit ce49b66

Please sign in to comment.