From 363fc47b885339bc867ada2ab6c5187e429ce0d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Thu, 3 Dec 2015 00:25:53 +0100 Subject: [PATCH] Improved error reporting --- src/map.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/map.cpp b/src/map.cpp index b443423b..6c0e7979 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -14,7 +14,10 @@ Map::Map(const QString &name, const QString &url) connect(&Downloader::instance(), SIGNAL(finished()), this, SLOT(emitLoaded())); - QDir::home().mkpath(QString(TILES_DIR"/%1").arg(_name)); + if (!QDir::home().mkpath(QString(TILES_DIR"/%1").arg(_name))) + fprintf(stderr, "Error creating tiles dir: %s\n", + qPrintable(QDir::home().absolutePath() + QString("/"TILES_DIR"/%1") + .arg(_name))); } void Map::emitLoaded() @@ -33,9 +36,11 @@ void Map::loadTiles(QList &list) .arg(t.xy().ry()); QFileInfo fi(file); - if (fi.exists()) - t.pixmap().load(file); - else { + if (fi.exists()) { + if (!t.pixmap().load(file)) + fprintf(stderr, "Error loading map tile: %s\n", + qPrintable(file)); + } else { t.pixmap() = QPixmap(TILE_SIZE, TILE_SIZE); t.pixmap().fill();