@@ -59,6 +59,10 @@ QgsSymbolV2* QgsSingleSymbolRendererV2::symbolForFeature( QgsFeature& feature )
59
59
60
60
void QgsSingleSymbolRendererV2::startRender ( QgsRenderContext& context, const QgsVectorLayer *vlayer )
61
61
{
62
+ if ( !mSymbol )
63
+ {
64
+ return ;
65
+ }
62
66
mRotationFieldIdx = ( mRotationField .isEmpty () ? -1 : vlayer->fieldNameIndex ( mRotationField ) );
63
67
mSizeScaleFieldIdx = ( mSizeScaleField .isEmpty () ? -1 : vlayer->fieldNameIndex ( mSizeScaleField ) );
64
68
@@ -93,6 +97,10 @@ void QgsSingleSymbolRendererV2::startRender( QgsRenderContext& context, const Qg
93
97
94
98
void QgsSingleSymbolRendererV2::stopRender ( QgsRenderContext& context )
95
99
{
100
+ if ( !mSymbol )
101
+ {
102
+ return ;
103
+ }
96
104
mSymbol ->stopRender ( context );
97
105
98
106
if ( mRotationFieldIdx != -1 || mSizeScaleFieldIdx != -1 )
@@ -127,7 +135,14 @@ void QgsSingleSymbolRendererV2::setSymbol( QgsSymbolV2* s )
127
135
128
136
QString QgsSingleSymbolRendererV2::dump ()
129
137
{
130
- return QString ( " SINGLE: %1" ).arg ( mSymbol ->dump () );
138
+ if ( mSymbol )
139
+ {
140
+ return QString ( " SINGLE: %1" ).arg ( mSymbol ->dump () );
141
+ }
142
+ else
143
+ {
144
+ return " " ;
145
+ }
131
146
}
132
147
133
148
QgsFeatureRendererV2* QgsSingleSymbolRendererV2::clone ()
@@ -198,10 +213,12 @@ QDomElement QgsSingleSymbolRendererV2::save( QDomDocument& doc )
198
213
199
214
QgsLegendSymbologyList QgsSingleSymbolRendererV2::legendSymbologyItems ( QSize iconSize )
200
215
{
201
- QPixmap pix = QgsSymbolLayerV2Utils::symbolPreviewPixmap ( mSymbol , iconSize );
202
-
203
216
QgsLegendSymbologyList lst;
204
- lst << qMakePair ( QString (), pix );
217
+ if ( mSymbol )
218
+ {
219
+ QPixmap pix = QgsSymbolLayerV2Utils::symbolPreviewPixmap ( mSymbol , iconSize );
220
+ lst << qMakePair ( QString (), pix );
221
+ }
205
222
return lst;
206
223
}
207
224
0 commit comments