Skip to content

Commit bed548d

Browse files
author
wonder
committed
Select a valid variant when there's no variant with the same number of colors in new scheme. Fixes #2254
git-svn-id: http://svn.osgeo.org/qgis/trunk@12511 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent ccc5471 commit bed548d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/gui/symbology-ng/qgsvectorcolorbrewercolorrampv2dialog.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,13 @@ void QgsVectorColorBrewerColorRampV2Dialog::populateVariants()
5959
}
6060

6161
// try to set the original variant again (if exists)
62-
cboColors->setCurrentIndex( cboColors->findText( oldVariant ) );
62+
int idx = cboColors->findText( oldVariant );
63+
if ( idx == -1 ) // not found?
64+
{
65+
// use the last item
66+
idx = cboColors->count() - 1;
67+
}
68+
cboColors->setCurrentIndex( idx );
6369
}
6470

6571
void QgsVectorColorBrewerColorRampV2Dialog::updatePreview()

0 commit comments

Comments
 (0)