summaryrefslogtreecommitdiff
path: root/src/mbgl/util/mapbox.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/util/mapbox.cpp')
-rw-r--r--src/mbgl/util/mapbox.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mbgl/util/mapbox.cpp b/src/mbgl/util/mapbox.cpp
index 97c28c0aeb..28dedaf25c 100644
--- a/src/mbgl/util/mapbox.cpp
+++ b/src/mbgl/util/mapbox.cpp
@@ -83,10 +83,18 @@ std::string normalizeSpriteURL(const std::string& url, const std::string& access
std::string id, extension;
if (isDraft) {
size_t index = pathname[3].find_first_of("@.");
+ if (index == std::string::npos) {
+ Log::Error(Event::ParseStyle, "Invalid sprite URL");
+ return url;
+ }
id = pathname[2];
extension = pathname[3].substr(index);
} else {
size_t index = pathname[2].find_first_of("@.");
+ if (index == std::string::npos) {
+ Log::Error(Event::ParseStyle, "Invalid sprite URL");
+ return url;
+ }
id = pathname[2].substr(0, index);
extension = pathname[2].substr(index);
}