From 59226af665468079fa662d4fa30a6adbd880d736 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Thu, 3 Jul 2014 12:30:42 +0200 Subject: [PATCH] correctly detect duplicate layers --- include/llmr/style/style_parser.hpp | 3 --- src/style/style_parser.cpp | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/include/llmr/style/style_parser.hpp b/include/llmr/style/style_parser.hpp index a1af11ef6..10cd3d2e8 100644 --- a/include/llmr/style/style_parser.hpp +++ b/include/llmr/style/style_parser.hpp @@ -102,9 +102,6 @@ private: // This maps ids to Layer objects, with all items being at the root level. std::unordered_map>> layers; - // Layer IDs that we have encountered previously while parsing this stylesheet. - std::set existing_layer_ids; - // Store a stack of layers we're parsing right now. This is to prevent reference cycles. std::forward_list stack; diff --git a/src/style/style_parser.cpp b/src/style/style_parser.cpp index b26f233cc..645f3aa0f 100644 --- a/src/style/style_parser.cpp +++ b/src/style/style_parser.cpp @@ -501,7 +501,7 @@ std::shared_ptr StyleParser::createLayer(JSVal value) { const std::string layer_id = { id.GetString(), id.GetStringLength() }; - if (existing_layer_ids.find(layer_id) != existing_layer_ids.end()) { + if (layers.find(layer_id) != layers.end()) { fprintf(stderr, "[WARNING] duplicate layer id %s\n", layer_id.c_str()); return nullptr; }