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/function.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'include/mbgl/style/function.hpp') diff --git a/include/mbgl/style/function.hpp b/include/mbgl/style/function.hpp index 97e880b280..3aefba6600 100644 --- a/include/mbgl/style/function.hpp +++ b/include/mbgl/style/function.hpp @@ -12,8 +12,10 @@ public: using Stop = std::pair; using Stops = std::vector; - explicit Function(Stops stops_, float base_) - : base(base_), stops(std::move(stops_)) {} + Function(Stops stops_, float base_) + : base(base_), stops(std::move(stops_)) { + assert(stops.size() > 0); + } float getBase() const { return base; } const std::vector>& getStops() const { return stops; } -- cgit v1.2.1