summaryrefslogtreecommitdiff
path: root/platform/default/src
diff options
context:
space:
mode:
authorJulian Rex <julian.rex@mapbox.com>2019-09-18 18:13:07 -0400
committerGitHub <noreply@github.com>2019-09-18 18:13:07 -0400
commit2b08c1d7bf9e867d6450feb6a246ce36dcdf2cd3 (patch)
tree8041d2169d2c26041c004c3336de08d031a3f9e8 /platform/default/src
parent7bca176beaf4dcae2263eeabee82fd7b6412654b (diff)
downloadqtlocation-mapboxgl-2b08c1d7bf9e867d6450feb6a246ce36dcdf2cd3.tar.gz
[ios, macos] Fix MGLOfflinePack invalidate crash (#15582)
Diffstat (limited to 'platform/default/src')
-rw-r--r--platform/default/src/mbgl/storage/offline_database.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/platform/default/src/mbgl/storage/offline_database.cpp b/platform/default/src/mbgl/storage/offline_database.cpp
index 83eea7bcc4..133e1f7992 100644
--- a/platform/default/src/mbgl/storage/offline_database.cpp
+++ b/platform/default/src/mbgl/storage/offline_database.cpp
@@ -124,6 +124,10 @@ void OfflineDatabase::handleError(const util::IOException& ex, const char* actio
Log::Error(Event::Database, ex.code, "Can't %s: %s", action, ex.what());
}
+void OfflineDatabase::handleError(const std::runtime_error& ex, const char* action) {
+ Log::Error(Event::Database, -1, "Can't %s: %s", action, ex.what());
+}
+
void OfflineDatabase::removeExisting() {
Log::Warning(Event::Database, "Removing existing incompatible offline database");
@@ -1059,6 +1063,11 @@ expected<OfflineRegionDefinition, std::exception_ptr> OfflineDatabase::getRegion
} catch (const mapbox::sqlite::Exception& ex) {
handleError(ex, "load region");
return unexpected<std::exception_ptr>(std::current_exception());
+} catch (const std::runtime_error& ex) {
+ // Catch errors from malformed offline region definitions
+ // and skip them (as above).
+ handleError(ex, "load region");
+ return unexpected<std::exception_ptr>(std::current_exception());
}
expected<OfflineRegionStatus, std::exception_ptr> OfflineDatabase::getRegionCompletedStatus(int64_t regionID) try {