diff options
Diffstat (limited to 'include/mbgl/style/conversion/constant.hpp')
-rw-r--r-- | include/mbgl/style/conversion/constant.hpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/include/mbgl/style/conversion/constant.hpp b/include/mbgl/style/conversion/constant.hpp index 7b3249da52..7d74ec42ce 100644 --- a/include/mbgl/style/conversion/constant.hpp +++ b/include/mbgl/style/conversion/constant.hpp @@ -33,14 +33,14 @@ struct Converter<T, typename std::enable_if_t<std::is_enum<T>::value>> { optional<T> operator()(const Convertible& value, Error& error) const { optional<std::string> string = toString(value); if (!string) { - error = { "value must be a string" }; - return {}; + error.message = "value must be a string"; + return nullopt; } const auto result = Enum<T>::toEnum(*string); if (!result) { - error = { "value must be a valid enumeration value" }; - return {}; + error.message = "value must be a valid enumeration value"; + return nullopt; } return *result; @@ -56,16 +56,16 @@ template <size_t N> struct Converter<std::array<float, N>> { optional<std::array<float, N>> operator()(const Convertible& value, Error& error) const { if (!isArray(value) || arrayLength(value) != N) { - error = { "value must be an array of " + util::toString(N) + " numbers" }; - return {}; + error.message = "value must be an array of " + util::toString(N) + " numbers"; + return nullopt; } std::array<float, N> result; for (size_t i = 0; i < N; i++) { optional<float> n = toNumber(arrayMember(value, i)); if (!n) { - error = { "value must be an array of " + util::toString(N) + " numbers" }; - return {}; + error.message = "value must be an array of " + util::toString(N) + " numbers"; + return nullopt; } result[i] = *n; } |