Skip to content

Commit 4cb5276

Browse files
author
jef
committed
add symbol ASSERTions
git-svn-id: http://svn.osgeo.org/qgis/trunk@14253 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 8e44395 commit 4cb5276

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/core/symbology-ng/qgssinglesymbolrendererv2.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@
1212
#include <QDomElement>
1313

1414
QgsSingleSymbolRendererV2::QgsSingleSymbolRendererV2( QgsSymbolV2* symbol )
15-
: QgsFeatureRendererV2( "singleSymbol" ),
16-
mTempSymbol( NULL )
15+
: QgsFeatureRendererV2( "singleSymbol" )
16+
, mTempSymbol( NULL )
1717
{
18+
Q_ASSERT( symbol );
1819
mSymbol = symbol;
1920
}
2021

@@ -59,8 +60,8 @@ QgsSymbolV2* QgsSingleSymbolRendererV2::symbolForFeature( QgsFeature& feature )
5960

6061
void QgsSingleSymbolRendererV2::startRender( QgsRenderContext& context, const QgsVectorLayer *vlayer )
6162
{
62-
mRotationFieldIdx = ( mRotationField.isEmpty() ? -1 : vlayer->fieldNameIndex( mRotationField ) );
63-
mSizeScaleFieldIdx = ( mSizeScaleField.isEmpty() ? -1 : vlayer->fieldNameIndex( mSizeScaleField ) );
63+
mRotationFieldIdx = mRotationField.isEmpty() ? -1 : vlayer->fieldNameIndex( mRotationField );
64+
mSizeScaleFieldIdx = mSizeScaleField.isEmpty() ? -1 : vlayer->fieldNameIndex( mSizeScaleField );
6465

6566
mSymbol->startRender( context );
6667

@@ -121,6 +122,7 @@ QgsSymbolV2* QgsSingleSymbolRendererV2::symbol() const
121122

122123
void QgsSingleSymbolRendererV2::setSymbol( QgsSymbolV2* s )
123124
{
125+
Q_ASSERT( s );
124126
delete mSymbol;
125127
mSymbol = s;
126128
}

src/core/symbology-ng/qgssymbollayerv2utils.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,8 @@ QIcon QgsSymbolLayerV2Utils::symbolPreviewIcon( QgsSymbolV2* symbol, QSize size
223223

224224
QPixmap QgsSymbolLayerV2Utils::symbolPreviewPixmap( QgsSymbolV2* symbol, QSize size )
225225
{
226+
Q_ASSERT( symbol );
227+
226228
QPixmap pixmap( size );
227229
QPainter painter;
228230
painter.begin( &pixmap );
@@ -472,6 +474,8 @@ static QString _nameForSymbolType( QgsSymbolV2::SymbolType type )
472474

473475
QDomElement QgsSymbolLayerV2Utils::saveSymbol( QString name, QgsSymbolV2* symbol, QDomDocument& doc, QgsSymbolV2Map* subSymbols )
474476
{
477+
Q_ASSERT( symbol );
478+
475479
QDomElement symEl = doc.createElement( "symbol" );
476480
symEl.setAttribute( "type", _nameForSymbolType( symbol->type() ) );
477481
symEl.setAttribute( "name", name );

0 commit comments

Comments
 (0)