Skip to content

Commit

Permalink
Fixed a bug that crashed QGIS when you try to build pyramids for read…
Browse files Browse the repository at this point in the history
…-only raster formats

git-svn-id: http://svn.osgeo.org/qgis/branches/Release-0_7-candidate@3671 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
larsl committed Jun 30, 2005
1 parent f267c27 commit 951d6a2
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions qgis/src/qgsrasterlayer.cpp
Expand Up @@ -3696,6 +3696,22 @@ void QgsRasterLayer::buildPyramids(RasterPyramidList theRasterPyramidList, QStri
//close the gdal dataset and reopen it in read / write mode
delete gdalDataset;
gdalDataset = (GDALDataset *) GDALOpen(dataSource, GA_Update);

// if the dataset couldn't be opened in read / write mode, tell the user
if (!gdalDataset) {
emit setProgress(0,0);
QApplication::restoreOverrideCursor();
QMessageBox myMessageBox( tr("Building pyramids failed."),
"Building pyramid overviews is only supported on certain types of raster.",
QMessageBox::Warning,
QMessageBox::Ok,
QMessageBox::NoButton,
QMessageBox::NoButton );
myMessageBox.exec();
gdalDataset = (GDALDataset *) GDALOpen(dataSource, GA_ReadOnly);
return;
}

//
// Iterate through the Raster Layer Pyramid Vector, building any pyramid
// marked as exists in eaxh RasterPyramid struct.
Expand Down

0 comments on commit 951d6a2

Please sign in to comment.