From 7d16824fda7086fbeb0a1deae3fc0abdf0c4832d Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Wed, 30 Nov 2016 10:17:47 -0800 Subject: [core] Functions must have at least one stop This is already enforced by the style validator in mapbox-gl-style-spec. Enforce it here too. --- include/mbgl/style/conversion/function.hpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/mbgl/style/conversion') diff --git a/include/mbgl/style/conversion/function.hpp b/include/mbgl/style/conversion/function.hpp index f14b5089be..6a0b67618f 100644 --- a/include/mbgl/style/conversion/function.hpp +++ b/include/mbgl/style/conversion/function.hpp @@ -25,6 +25,10 @@ struct Converter> { return Error { "function stops must be an array" }; } + if (arrayLength(*stopsValue) == 0) { + return Error { "function must have at least one stop" }; + } + std::vector> stops; for (std::size_t i = 0; i < arrayLength(*stopsValue); ++i) { const auto& stopValue = arrayMember(*stopsValue, i); -- cgit v1.2.1