Skip to content

Commit 1549311

Browse files
author
jef
committed
fix #2670
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13508 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 2a55b8c commit 1549311

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

src/core/qgscoordinatereferencesystem.cpp

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#include "qgsmessageoutput.h"
3232
#include "qgis.h" //const vals declared here
3333

34-
#include <cassert>
3534
#include <sqlite3.h>
3635

3736
//gdal and ogr includes (needed for == operator)
@@ -1145,7 +1144,7 @@ QString QgsCoordinateReferenceSystem::proj4FromSrsId( const int theSrsId )
11451144
// close the database
11461145
sqlite3_close( db );
11471146

1148-
//assert(myProjString.length() > 0);
1147+
//Q_ASSERT(myProjString.length() > 0);
11491148
return myProjString;
11501149
}
11511150

@@ -1259,12 +1258,10 @@ bool QgsCoordinateReferenceSystem::saveAsUserCRS()
12591258
myResult = sqlite3_open( QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase );
12601259
if ( myResult != SQLITE_OK )
12611260
{
1262-
QgsDebugMsg( QString( "Can't open database: %1 \n please notify QGIS developers of this error \n %2 (file name) " )
1263-
.arg( sqlite3_errmsg( myDatabase ) )
1264-
.arg( QgsApplication::qgisUserDbFilePath() ) );
1265-
// XXX This will likely never happen since on open, sqlite creates the
1266-
// database if it does not exist.
1267-
assert( myResult == SQLITE_OK );
1261+
QgsDebugMsg( QString( "Can't open or create database %1: %2" )
1262+
.arg( QgsApplication::qgisUserDbFilePath() )
1263+
.arg( sqlite3_errmsg( myDatabase ) ) );
1264+
return false;
12681265
}
12691266
QgsDebugMsg( QString( "Update or insert sql \n%1" ).arg( mySql ) );
12701267
myResult = sqlite3_prepare( myDatabase, mySql.toUtf8(), mySql.toUtf8().length(), &myPreparedStatement, &myTail );
@@ -1285,9 +1282,7 @@ long QgsCoordinateReferenceSystem::getRecordCount()
12851282
if ( myResult != SQLITE_OK )
12861283
{
12871284
QgsDebugMsg( QString( "Can't open database: %1" ).arg( sqlite3_errmsg( myDatabase ) ) );
1288-
// XXX This will likely never happen since on open, sqlite creates the
1289-
// database if it does not exist.
1290-
assert( myResult == SQLITE_OK );
1285+
return 0;
12911286
}
12921287
// Set up the query to retrieve the projection information needed to populate the ELLIPSOID list
12931288
QString mySql = "select count(*) from tbl_srs";

0 commit comments

Comments
 (0)