Skip to content

Commit

Permalink
QgsMimeDataUtils::Uri fixed crash on empty data
Browse files Browse the repository at this point in the history
  • Loading branch information
blazek committed Dec 16, 2014
1 parent d0ea44a commit 4e4e161
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/core/qgsmimedatautils.cpp
Expand Up @@ -46,6 +46,8 @@ QgsMimeDataUtils::Uri::Uri( QString& encData )
QChar escape = '\\';
QString part;
bool inEscape = false;
if ( encData.isEmpty() )
return;
for ( int i = 0; i < encData.length(); ++i )
{
if ( encData.at( i ) == escape && !inEscape )
Expand All @@ -70,17 +72,17 @@ QgsMimeDataUtils::Uri::Uri( QString& encData )

if ( parts.size() <= 5 ) // PostGISTRaster layers yields five parts
{
layerType = parts[0];
providerKey = parts[1];
name = parts[2];
layerType = parts.value( 0 );
providerKey = parts.value( 1 );
name = parts.value( 2 );
// fetchs PostGISRaster layers
if ( parts[3] == "PG" )
if ( parts.value( 3 ) == "PG" )
{
uri = parts[3] + ":" + parts[4];
uri = parts.value( 3 ) + ":" + parts.value( 4 );
}
else
{
uri = parts[3];
uri = parts.value( 3 );
}
QgsDebugMsg( "type: " + layerType + " key: " + providerKey + " name: " + name + " uri: " + uri );
}
Expand Down

0 comments on commit 4e4e161

Please sign in to comment.