Skip to content

Commit

Permalink
Fix crash on QMap iteration in Qt5
Browse files Browse the repository at this point in the history
  • Loading branch information
wonder-sk committed Sep 12, 2016
1 parent 4fa3191 commit 0259935
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions src/providers/wms/qgswmscapabilities.cpp
Expand Up @@ -2157,9 +2157,25 @@ const QgsWmtsTileMatrix *QgsWmtsTileMatrixSet::findOtherResolution( double tres,
QMap<double, QgsWmtsTileMatrix>::const_iterator it = tileMatrices.constFind( tres );
if ( it == tileMatrices.constEnd() )
return nullptr;
it += offset;
if ( it == tileMatrices.constEnd() )
return nullptr;
while ( 1 )
{
if ( offset > 0 )
{
++it;
--offset;
}
else if ( offset < 0 )
{
if ( it == tileMatrices.constBegin() )
return nullptr;
--it;
++offset;
}
else
break;

if ( it == tileMatrices.constEnd() )
return nullptr;
}
return &it.value();
}

0 comments on commit 0259935

Please sign in to comment.