Skip to content

Commit

Permalink
[composer] Fix crash when loading project
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Aug 18, 2014
1 parent 1a89731 commit 0b213b6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
9 changes: 7 additions & 2 deletions src/core/composer/qgscomposermapoverview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ void QgsComposerMapOverview::setFrameMap( const int mapId )
}

//disconnect old map
if ( mFrameMapId != -1 && mComposerMap->composition() )
if ( mFrameMapId != -1 && mComposerMap && mComposerMap->composition() )
{
const QgsComposerMap* map = mComposerMap->composition()->getComposerMapById( mFrameMapId );
if ( map )
Expand All @@ -218,6 +218,11 @@ void QgsComposerMapOverview::setFrameMap( const int mapId )

void QgsComposerMapOverview::connectSignals()
{
if ( !mComposerMap )
{
return;
}

if ( mFrameMapId != -1 && mComposerMap->composition() )
{
const QgsComposerMap* map = mComposerMap->composition()->getComposerMapById( mFrameMapId );
Expand Down Expand Up @@ -258,7 +263,7 @@ void QgsComposerMapOverview::overviewExtentChanged()
}

//if using overview centering, update the map's extent
if ( mComposerMap && mComposerMap->composition() && mCentered && mFrameMapId != -1 )
if ( mComposerMap->composition() && mCentered && mFrameMapId != -1 )
{
QgsRectangle extent = *mComposerMap->currentMapExtent();

Expand Down
5 changes: 3 additions & 2 deletions src/core/composer/qgscomposition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1057,8 +1057,9 @@ void QgsComposition::addItemsFromXML( const QDomElement& elem, const QDomDocumen
QgsComposerMap* map = ( *mit );
if ( map )
{
QList<QgsComposerMapOverview* >::iterator overviewIt = map->mapOverviews().begin();
for ( ; overviewIt != map->mapOverviews().end(); ++overviewIt )
QList<QgsComposerMapOverview* > overviews = map->mapOverviews();
QList<QgsComposerMapOverview* >::iterator overviewIt = overviews.begin();
for ( ; overviewIt != overviews.end(); ++overviewIt )
{
( *overviewIt )->connectSignals();
}
Expand Down

0 comments on commit 0b213b6

Please sign in to comment.