[core] Fixed {prefix} evaluation

This appears to have been an attempt to use the std::string fill constructor, but it ended up creating a one-character-long string and attempting to overwrite the null terminator.
This commit is contained in:
Minh Nguyễn
2018-11-20 16:59:17 -08:00
parent 594d2074a3
commit 7d5be980e2
5 changed files with 12 additions and 7 deletions

View File

@@ -123,10 +123,10 @@ Resource Resource::tile(const std::string& urlTemplate,
} else if (token == "bbox-epsg-3857") {
return getTileBBox(x, y, z);
} else if (token == "prefix") {
std::string prefix{ 2 };
prefix[0] = "0123456789abcdef"[x % 16];
prefix[1] = "0123456789abcdef"[y % 16];
return prefix;
return {{
"0123456789abcdef"[x % 16],
"0123456789abcdef"[y % 16],
}};
} else if (token == "ratio") {
return std::string(pixelRatio > 1.0 ? "@2x" : "");
} else {