Skip to content

Commit 3a8b816

Browse files
author
mcoletti
committed
Now appropriately whines when attempting to open a project file that has no
layers instead of just crashing. git-svn-id: http://svn.osgeo.org/qgis/trunk@2578 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent ef266f4 commit 3a8b816

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

src/qgisapp.cpp

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1624,13 +1624,22 @@ void QgisApp::fileOpen()
16241624

16251625
QgsProject::instance()->filename( fullPath );
16261626

1627-
if ( QgsProject::instance()->read() )
1627+
try
16281628
{
1629-
setTitleBarText_( *this );
1630-
mMapCanvas->setMapUnits(QgsProject::instance()->mapUnits());
1631-
emit projectRead(); // let plug-ins know that we've read in a new
1632-
// project so that they can check any project
1633-
// specific plug-in state
1629+
if ( QgsProject::instance()->read() )
1630+
{
1631+
setTitleBarText_( *this );
1632+
mMapCanvas->setMapUnits(QgsProject::instance()->mapUnits());
1633+
emit projectRead(); // let plug-ins know that we've read in a new
1634+
// project so that they can check any project
1635+
// specific plug-in state
1636+
}
1637+
}
1638+
catch ( std::exception & e )
1639+
{
1640+
QMessageBox::critical(this,
1641+
tr("QGIS Project Read Error"),
1642+
tr("") + "\n" + e.what() );
16341643
}
16351644
}
16361645

@@ -3083,7 +3092,7 @@ void QgisApp::socketConnectionClosed()
30833092
void QgisApp::socketError(int e)
30843093
{
30853094
QApplication::restoreOverrideCursor();
3086-
// get errror type
3095+
// get error type
30873096
QString detail;
30883097
switch (e)
30893098
{

0 commit comments

Comments
 (0)