Skip to content

Commit 5b46f48

Browse files
committed
External Resource Widget: avoid having undefined value in document viewer type combobox
1 parent d3852e4 commit 5b46f48

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/gui/editorwidgets/qgsexternalresourceconfigdlg.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,11 @@ void QgsExternalResourceConfigDlg::setConfig( const QgsEditorWidgetConfig& confi
207207
{
208208
QgsExternalResourceWidget::DocumentViewerContent content = ( QgsExternalResourceWidget::DocumentViewerContent )config.value( "DocumentViewer" ).toInt();
209209
mDocumentViewerGroupBox->setChecked( content != QgsExternalResourceWidget::NoContent );
210-
mDocumentViewerContentComboBox->setCurrentIndex( mDocumentViewerContentComboBox->findData( content ) );
210+
int idx = mDocumentViewerContentComboBox->findData( content );
211+
if ( idx >= 0 )
212+
{
213+
mDocumentViewerContentComboBox->setCurrentIndex( idx );
214+
}
211215
if ( config.contains( "DocumentViewerHeight" ) )
212216
{
213217
mDocumentViewerHeight->setValue( config.value( "DocumentViewerHeight" ).toInt() );

0 commit comments

Comments
 (0)