From 189b5c2f60f2eec4a8b5b95dbfb26c082e4a9d5d Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Tue, 26 Apr 2016 11:27:59 -0700 Subject: [PATCH] [core] Rewrite parsePropertyTransition to work around GCC 4.9 bug --- src/mbgl/style/property_parsing.cpp | 33 ++++++++++++++++------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/mbgl/style/property_parsing.cpp b/src/mbgl/style/property_parsing.cpp index 7994f245e..362b0d7b5 100644 --- a/src/mbgl/style/property_parsing.cpp +++ b/src/mbgl/style/property_parsing.cpp @@ -262,22 +262,25 @@ optional> parseConstant(const char* name, const JSValue } optional parsePropertyTransition(const char *, const JSValue& value) { - PropertyTransition transition; - if (value.IsObject()) { - bool parsed = false; - if (value.HasMember("duration") && value["duration"].IsNumber()) { - transition.duration.emplace(Milliseconds(value["duration"].GetUint())); - parsed = true; - } - if (value.HasMember("delay") && value["delay"].IsNumber()) { - transition.delay.emplace(Milliseconds(value["delay"].GetUint())); - parsed = true; - } - if (!parsed) { - return {}; - } + if (!value.IsObject()) { + return {}; } - return transition; + + optional duration; + if (value.HasMember("duration") && value["duration"].IsNumber()) { + duration.emplace(Milliseconds(value["duration"].GetUint())); + } + + optional delay; + if (value.HasMember("delay") && value["delay"].IsNumber()) { + delay.emplace(Milliseconds(value["delay"].GetUint())); + } + + if (!duration && !delay) { + return {}; + } + + return PropertyTransition(duration, delay); } } // namespace mbgl