Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
prevent crash from north arrow if project CRS is not defined (fix #16874
- Loading branch information
Showing
with
9 additions
and
2 deletions.
-
+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" ) ); |
|
|
} |
|
|
} |
|
|
|
|
|
} |