Bounds-check array access at source

This commit is contained in:
John Firebaugh
2015-04-06 11:51:31 -07:00
parent d2314aedc6
commit 5ec04c0474
2 changed files with 1 additions and 4 deletions

View File

@@ -97,7 +97,7 @@ void SourceInfo::parseTileJSONProperties(const rapidjson::Value& value) {
}
std::string SourceInfo::tileURL(const Tile::ID& id, float pixelRatio) const {
std::string result = tiles[(id.x + id.y) % tiles.size()];
std::string result = tiles.at((id.x + id.y) % tiles.size());
result = util::mapbox::normalizeTileURL(result, url, type);
result = util::replaceTokens(result, [&](const std::string &token) -> std::string {
if (token == "z") return util::toString(id.z);

View File

@@ -30,9 +30,6 @@ const std::string TileData::toString() const {
}
void TileData::request(uv::worker &worker, float pixelRatio, std::function<void()> callback) {
if (source.tiles.empty())
return;
std::string url = source.tileURL(id, pixelRatio);
state = State::loading;