diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2016-07-20 13:16:49 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2016-07-20 15:33:09 +0200 |
commit | a07fbe8e34a31fd28266cede03162258efe642c3 (patch) | |
tree | 941d1a24bb0e8c83ffb0f4d7d36e2cbef3d0acae /src/mbgl/style | |
parent | 000539af828b0b3b0a7b0f145434b2556b5a08c3 (diff) | |
download | qtlocation-mapboxgl-a07fbe8e34a31fd28266cede03162258efe642c3.tar.gz |
[core] fix crash when the style JSON doesn't have an object at its root
Diffstat (limited to 'src/mbgl/style')
-rw-r--r-- | src/mbgl/style/parser.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mbgl/style/parser.cpp b/src/mbgl/style/parser.cpp index 41b23c1bae..56e6f8ad01 100644 --- a/src/mbgl/style/parser.cpp +++ b/src/mbgl/style/parser.cpp @@ -29,6 +29,11 @@ void Parser::parse(const std::string& json) { return; } + if (!document.IsObject()) { + Log::Error(Event::ParseStyle, "Style JSON must be an object"); + return; + } + if (document.HasMember("version")) { int version = document["version"].GetInt(); if (version != 8) { |