Skip to content

Commit

Permalink
GRASS: fixed crash when opening vector without topo
Browse files Browse the repository at this point in the history
  • Loading branch information
blazek committed Nov 6, 2014
1 parent d74b52e commit d8d9edb
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/providers/grass/qgsgrassprovider.cpp
Expand Up @@ -798,21 +798,26 @@ int QgsGrassProvider::openMap( QString gisdbase, QString location, QString mapse
map.lastAttributesModified = di.lastModified();

// Do we have topology and cidx (level2)
int level = 2;
int level = -1;
G_TRY
{
Vect_set_open_level( 2 );
Vect_open_old_head( map.map, mapName.toUtf8().data(), mapset.toUtf8().data() );
//Vect_set_open_level( 2 );
level = Vect_open_old_head( map.map, mapName.toUtf8().data(), mapset.toUtf8().data() );
Vect_close( map.map );
}
G_CATCH( QgsGrass::Exception &e )
{
Q_UNUSED( e );
QgsDebugMsg( QString( "Cannot open GRASS vector head on level2: %1" ).arg( e.what() ) );
level = 1;
level = -1;
}

if ( level == 1 )
if ( level == -1 )
{
QgsDebugMsg( "Cannot open GRASS vector head" );
return -1;
}
else if ( level == 1 )
{
QMessageBox::StandardButton ret = QMessageBox::question( 0, "Warning",
tr( "GRASS vector map %1 does not have topology. Build topology?" ).arg( mapName ),
Expand Down

0 comments on commit d8d9edb

Please sign in to comment.