summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libdimension/color_map.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libdimension/color_map.c b/libdimension/color_map.c
index 4832e87..f567db6 100644
--- a/libdimension/color_map.c
+++ b/libdimension/color_map.c
@@ -65,6 +65,10 @@ dmnsn_color_map_value(const dmnsn_color_map *map, double n)
double n1, n2 = 0.0;
dmnsn_color c1, c2 = entry->color;
+ if (n < n2) {
+ return c2;
+ }
+
for (; entry <= (dmnsn_color_map_entry *)dmnsn_array_last(map); ++entry) {
n1 = n2;
c1 = c2;