|
@@ -141,7 +141,7 @@ void ColorRamp::set_offset(int pos, const float offset) {
|
|
}
|
|
}
|
|
|
|
|
|
float ColorRamp::get_offset(int pos) const {
|
|
float ColorRamp::get_offset(int pos) const {
|
|
- if (points.size() > pos)
|
|
|
|
|
|
+ if (points.size() && points.size() > pos)
|
|
return points[pos].offset;
|
|
return points[pos].offset;
|
|
return 0; //TODO: Maybe throw some error instead?
|
|
return 0; //TODO: Maybe throw some error instead?
|
|
}
|
|
}
|
|
@@ -155,7 +155,7 @@ void ColorRamp::set_color(int pos, const Color &color) {
|
|
}
|
|
}
|
|
|
|
|
|
Color ColorRamp::get_color(int pos) const {
|
|
Color ColorRamp::get_color(int pos) const {
|
|
- if (points.size() > pos)
|
|
|
|
|
|
+ if (points.size() && points.size() > pos)
|
|
return points[pos].color;
|
|
return points[pos].color;
|
|
return Color(0, 0, 0, 1); //TODO: Maybe throw some error instead?
|
|
return Color(0, 0, 0, 1); //TODO: Maybe throw some error instead?
|
|
}
|
|
}
|