Skip to content
Permalink
Browse files

Prevent adding the same external tileset multiple times

Would assert in a debug build and probably cause issues in a release
build as well.
  • Loading branch information...
bjorn committed May 8, 2017
1 parent 6ec324e commit 0e397fe54023e45ac2d01f368718c3b697d0d621
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/tiled/mainwindow.cpp
@@ -584,7 +584,7 @@ bool MainWindow::openFile(const QString &fileName, FileFormat *fileFormat)
}

if (!fileFormat) {
QMessageBox::critical(this, tr("Error Opening File"), tr("Unrecognized file format"));
QMessageBox::critical(this, tr("Error Opening File"), tr("Unrecognized file format."));
return false;
}

@@ -1248,7 +1248,8 @@ void MainWindow::addExternalTileset()
QString error;
SharedTileset tileset = TilesetManager::instance()->loadTileset(fileName, &error);
if (tileset) {
tilesets.append(tileset);
if (!mapDocument->map()->tilesets().contains(tileset))
tilesets.append(tileset);
} else if (fileNames.size() == 1) {
QMessageBox::critical(this, tr("Error Reading Tileset"), error);
return;

0 comments on commit 0e397fe

Please sign in to comment.
You can’t perform that action at this time.