summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Nienhüser <nienhueser@kde.org>2016-10-01 08:44:22 (GMT)
committerDennis Nienhüser <nienhueser@kde.org>2016-10-01 08:44:22 (GMT)
commit132dd389b2861433f63b98462c72507b8a0e727e (patch)
treea7d2ac22858dc2f3a63a1667636929d1d48928e5
parentec804223cd061d6b4b33cb5f4fe8924002cd2aec (diff)
Check file existance/readability before parsing
-rw-r--r--src/plugins/runner/osm/OsmParser.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/plugins/runner/osm/OsmParser.cpp b/src/plugins/runner/osm/OsmParser.cpp
index e5f6641..8fecaef 100644
--- a/src/plugins/runner/osm/OsmParser.cpp
+++ b/src/plugins/runner/osm/OsmParser.cpp
@@ -33,6 +33,11 @@ namespace Marble {
GeoDataDocument *OsmParser::parse(const QString &filename, QString &error)
{
QFileInfo const fileInfo(filename);
+ if (!fileInfo.exists() || !fileInfo.isReadable()) {
+ error = QString("Cannot read file %1").arg(filename);
+ return 0;
+ }
+
if (fileInfo.completeSuffix() == QLatin1String("o5m")) {
return parseO5m(filename, error);
} else {