Skip to content

Commit 73ab289

Browse files
committed
Fix Coverity warnings in testqgsogcutils.cpp and testqgsgdalprovider.cpp
1 parent 2b1560c commit 73ab289

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

tests/src/core/testqgsogcutils.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,8 @@ void TestQgsOgcUtils::testExpressionToOgcFilterWFS11_data()
432432
static QString normalizeXML( const QString& xmlText )
433433
{
434434
QDomDocument doc;
435-
doc.setContent( xmlText, true );
435+
if ( !doc.setContent( xmlText, true ) )
436+
return QString();
436437
return doc.toString( -1 );
437438
}
438439

tests/src/providers/testqgsgdalprovider.cpp

+8-2
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,10 @@ void TestQgsGdalProvider::noData()
117117
QVERIFY( provider->isValid() );
118118
QgsRasterDataProvider* rp = dynamic_cast< QgsRasterDataProvider* >( provider );
119119
QVERIFY( rp );
120-
QCOMPARE( rp->srcNoDataValue( 1 ), static_cast<double>( 255 ) );
120+
if ( rp )
121+
{
122+
QCOMPARE( rp->srcNoDataValue( 1 ), static_cast<double>( 255 ) );
123+
}
121124
delete provider;
122125
}
123126

@@ -128,7 +131,10 @@ void TestQgsGdalProvider::invalidNoDataInSourceIgnored()
128131
QVERIFY( provider->isValid() );
129132
QgsRasterDataProvider* rp = dynamic_cast< QgsRasterDataProvider* >( provider );
130133
QVERIFY( rp );
131-
QCOMPARE( rp->srcHasNoDataValue( 1 ), false );
134+
if ( rp )
135+
{
136+
QCOMPARE( rp->srcHasNoDataValue( 1 ), false );
137+
}
132138
delete provider;
133139
}
134140

0 commit comments

Comments
 (0)