summaryrefslogtreecommitdiff
path: root/src/mbgl/style/parser.cpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2016-07-20 13:22:09 +0200
committerKonstantin Käfer <mail@kkaefer.com>2016-07-20 15:33:09 +0200
commit03ebae0f2ed0e5ff2c4fe284d8d3db8960ae4938 (patch)
tree66427e9661c06f909c579e3359b4448dbd3bc03b /src/mbgl/style/parser.cpp
parenta07fbe8e34a31fd28266cede03162258efe642c3 (diff)
downloadqtlocation-mapboxgl-03ebae0f2ed0e5ff2c4fe284d8d3db8960ae4938.tar.gz
[core] don't crash when the version number is not a number
Diffstat (limited to 'src/mbgl/style/parser.cpp')
-rw-r--r--src/mbgl/style/parser.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/mbgl/style/parser.cpp b/src/mbgl/style/parser.cpp
index 56e6f8ad01..2746b8af92 100644
--- a/src/mbgl/style/parser.cpp
+++ b/src/mbgl/style/parser.cpp
@@ -35,7 +35,8 @@ void Parser::parse(const std::string& json) {
}
if (document.HasMember("version")) {
- int version = document["version"].GetInt();
+ const JSValue& versionValue = document["version"];
+ const int version = versionValue.IsNumber() ? versionValue.GetInt() : 0;
if (version != 8) {
Log::Warning(Event::ParseStyle, "current renderer implementation only supports style spec version 8; using an outdated style will cause rendering errors");
}