Skip to content
Permalink
Browse files

QgsMimeDataUtils::Uri fixed crash on empty data

  • Loading branch information
blazek committed Dec 16, 2014
1 parent d0ea44a commit 4e4e161b94cde306fd4b355cddf7b5c0e860dcde
Showing with 8 additions and 6 deletions.
  1. +8 −6 src/core/qgsmimedatautils.cpp
@@ -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 )
@@ -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 );
}

0 comments on commit 4e4e161

Please sign in to comment.
You can’t perform that action at this time.