Skip to content

Commit cf7303f

Browse files
committedMay 30, 2015
Fix some possible null pointer dereferences
1 parent e5fb5a6 commit cf7303f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed
 

‎src/gui/symbology-ng/qgsrendererv2widget.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ void QgsRendererV2Widget::changeSymbolWidth()
137137
QList<QgsSymbolV2*>::iterator symbolIt = symbolList.begin();
138138
for ( ; symbolIt != symbolList.end(); ++symbolIt )
139139
{
140-
dynamic_cast<QgsLineSymbolV2*>( *symbolIt )->setWidth( dlg.mSpinBox->value() );
140+
if (( *symbolIt )->type() == QgsSymbolV2::Line )
141+
static_cast<QgsLineSymbolV2*>( *symbolIt )->setWidth( dlg.mSpinBox->value() );
141142
}
142143
}
143144
refreshSymbolView();
@@ -161,7 +162,8 @@ void QgsRendererV2Widget::changeSymbolSize()
161162
QList<QgsSymbolV2*>::iterator symbolIt = symbolList.begin();
162163
for ( ; symbolIt != symbolList.end(); ++symbolIt )
163164
{
164-
dynamic_cast<QgsMarkerSymbolV2*>( *symbolIt )->setSize( dlg.mSpinBox->value() );
165+
if (( *symbolIt )->type() == QgsSymbolV2::Marker )
166+
static_cast<QgsMarkerSymbolV2*>( *symbolIt )->setSize( dlg.mSpinBox->value() );
165167
}
166168
}
167169
refreshSymbolView();
@@ -185,7 +187,8 @@ void QgsRendererV2Widget::changeSymbolAngle()
185187
QList<QgsSymbolV2*>::iterator symbolIt = symbolList.begin();
186188
for ( ; symbolIt != symbolList.end(); ++symbolIt )
187189
{
188-
dynamic_cast<QgsMarkerSymbolV2*>( *symbolIt )->setAngle( dlg.mSpinBox->value() );
190+
if (( *symbolIt )->type() == QgsSymbolV2::Marker )
191+
static_cast<QgsMarkerSymbolV2*>( *symbolIt )->setAngle( dlg.mSpinBox->value() );
189192
}
190193
}
191194
refreshSymbolView();

0 commit comments

Comments
 (0)
Please sign in to comment.