Skip to content

Commit

Permalink
Fix - crash while restoring a graphic board from a file
Browse files Browse the repository at this point in the history
  • Loading branch information
Przemyslawmd committed Jul 26, 2019
1 parent a0b761f commit e09f6bf
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Project/GraphicBoard/ImageProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,15 @@ Result ImageProvider::restoreGraphicBoardFromFile( QDataStream& stream, BoardSiz
}

TileSize tileSize = Mapped::getTileSizeByInt( tileSizeInt );
removeBoard( images.at( boardSize ));
images.at( boardSize ) = new GraphicBoard();

if ( images.at( boardSize )->restoreImagesFromFile( stream, boardSize, tileSize ) == false )
{
removeBoard( images.at( boardSize ));
return Result::READ_BOARD_IMAGES_DATA_ERROR;
}

removeBoard( images.at( boardSize ));
images.at( boardSize ) = new GraphicBoard();
return Result::OK;
}

Expand Down

0 comments on commit e09f6bf

Please sign in to comment.