Skip to content
Permalink
Browse files
Fix crash with relative file paths if projPath is not yet defined
  • Loading branch information
mhugent committed Dec 5, 2011
1 parent a129207 commit 917f748d33d4a41f700e744c9b54792e4355257a
Showing with 12 additions and 2 deletions.
  1. +12 −2 src/core/qgsproject.cpp
14 src/core/qgsproject.cpp 100755 → 100644
@@ -1336,7 +1336,7 @@ void QgsProject::dumpProperties() const
// return the absolute path from a filename read from project file
QString QgsProject::readPath( QString src ) const
{
if ( readBoolEntry( "Paths", "/Absolute", true ) )
if ( readBoolEntry( "Paths", "/Absolute", false ) )
{
return src;
}
@@ -1383,6 +1383,11 @@ QString QgsProject::readPath( QString src ) const
QString srcPath = src;
QString projPath = fileName();

if ( projPath.isEmpty() )
{
return src;
}

#if defined(Q_OS_WIN)
srcPath.replace( "\\", "/" );
projPath.replace( "\\", "/" );
@@ -1428,14 +1433,19 @@ QString QgsProject::readPath( QString src ) const
// return the absolute or relative path to write it to the project file
QString QgsProject::writePath( QString src ) const
{
if ( readBoolEntry( "Paths", "/Absolute", true ) || src.isEmpty() )
if ( readBoolEntry( "Paths", "/Absolute", false ) || src.isEmpty() )
{
return src;
}

QString srcPath = src;
QString projPath = fileName();

if ( projPath.isEmpty() )
{
return src;
}

#if defined( Q_OS_WIN )
const Qt::CaseSensitivity cs = Qt::CaseInsensitive;

0 comments on commit 917f748

Please sign in to comment.