File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -117,12 +117,15 @@ void QgsColorSchemeRegistry::setRandomStyleColorScheme( QgsColorScheme *scheme )
117
117
{
118
118
mRandomStyleColors = scheme->fetchColors ();
119
119
120
- std::random_device rd;
121
- std::mt19937 mt ( rd () );
122
- std::uniform_int_distribution<int > colorDist ( 0 , mRandomStyleColors .count () - 1 );
123
- mNextRandomStyleColorIndex = colorDist ( mt );
124
- std::uniform_int_distribution<int > colorDir ( 0 , 1 );
125
- mNextRandomStyleColorDirection = colorDir ( mt ) == 0 ? -1 : 1 ;
120
+ if ( mRandomStyleColors .count () > 0 )
121
+ {
122
+ std::random_device rd;
123
+ std::mt19937 mt ( rd () );
124
+ std::uniform_int_distribution<int > colorDist ( 0 , mRandomStyleColors .count () - 1 );
125
+ mNextRandomStyleColorIndex = colorDist ( mt );
126
+ std::uniform_int_distribution<int > colorDir ( 0 , 1 );
127
+ mNextRandomStyleColorDirection = colorDir ( mt ) == 0 ? -1 : 1 ;
128
+ }
126
129
}
127
130
else
128
131
{
You can’t perform that action at this time.
0 commit comments