Skip to content
Permalink
Browse files

prevent crash from north arrow if project CRS is not defined (fix #16874

)
  • Loading branch information
alexbruy committed Nov 10, 2017
1 parent 30cefca commit 19b1b7992d300aebfa72c6a0ee57431ce174677d
Showing with 9 additions and 2 deletions.
  1. +9 −2 src/app/qgsdecorationnortharrow.cpp
@@ -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();
}

@@ -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.
You can’t perform that action at this time.