summaryrefslogtreecommitdiff
path: root/src/mbgl/map/live_tile_data.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/map/live_tile_data.cpp')
-rw-r--r--src/mbgl/map/live_tile_data.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/mbgl/map/live_tile_data.cpp b/src/mbgl/map/live_tile_data.cpp
index 6456e51538..8b4f46deb5 100644
--- a/src/mbgl/map/live_tile_data.cpp
+++ b/src/mbgl/map/live_tile_data.cpp
@@ -31,13 +31,14 @@ void LiveTileData::parse() {
return;
}
- try {
- if (!style) {
- throw std::runtime_error("style isn't present in LiveTileData object anymore");
- }
+ const LiveTile* tile = annotationManager.getTile(id);
+
+ if (tile) {
+ try {
+ if (!style) {
+ throw std::runtime_error("style isn't present in LiveTileData object anymore");
+ }
- const LiveTile* tile = annotationManager.getTile(id);
- if (tile) {
// Parsing creates state that is encapsulated in TileParser. While parsing,
// the TileParser object writes results into this objects. All other state
// is going to be discarded afterwards.
@@ -47,13 +48,16 @@ void LiveTileData::parse() {
style.reset();
parser.parse();
- } else {
+ } catch (const std::exception& ex) {
+ Log::Error(Event::ParseTile, "Live-parsing [%d/%d/%d] failed: %s", id.z, id.x, id.y, ex.what());
state = State::obsolete;
+ return;
}
- } catch (const std::exception& ex) {
- Log::Error(Event::ParseTile, "Live-parsing [%d/%d/%d] failed: %s", id.z, id.x, id.y, ex.what());
+ } else {
+ // Clear the style so that we don't have a cycle in the shared_ptr references.
+ style.reset();
+
state = State::obsolete;
- return;
}
if (state != State::obsolete) {