Skip to content
Permalink
Browse files
Fix crash with relative file paths if projPath is not yet defined
  • Loading branch information
mhugent authored and mach0 committed Dec 7, 2011
1 parent 5386cfc commit 4ddb93820dd9127364e602186c924881c6a8b62a
Showing with 12 additions and 2 deletions.
  1. +12 −2 src/core/qgsproject.cpp
@@ -1350,7 +1350,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;
}
@@ -1395,6 +1395,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( "\\", "/" );
@@ -1440,14 +1445,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 4ddb938

Please sign in to comment.