Skip to content

Commit

Permalink
prevent crash from north arrow if project CRS is not defined (fix #16874
Browse files Browse the repository at this point in the history
)
  • Loading branch information
alexbruy committed Nov 10, 2017
1 parent 30cefca commit 19b1b79
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/app/qgsdecorationnortharrow.cpp
Expand Up @@ -123,7 +123,15 @@ void QgsDecorationNorthArrow::render( const QgsMapSettings &mapSettings, QgsRend
// called when the projection or map extent changes
if ( mAutomatic )
{
mRotationInt = QgsBearingUtils:: bearingTrueNorth( mapSettings.destinationCrs(), context.extent().center() );
try
{
mRotationInt = QgsBearingUtils:: bearingTrueNorth( mapSettings.destinationCrs(), context.extent().center() );
}
catch ( QgsException &e )
{
mRotationInt = 0.0;
//QgsDebugMsg( "Can not get direction to true north. Probably project CRS is not defined." );
}
mRotationInt += mapSettings.rotation();
}

Expand Down Expand Up @@ -210,5 +218,4 @@ void QgsDecorationNorthArrow::render( const QgsMapSettings &mapSettings, QgsRend
context.painter()->drawText( 10, 20, tr( "North arrow pixmap not found" ) );
}
}

}

0 comments on commit 19b1b79

Please sign in to comment.