Merge pull request #10506 from hpvb/fix-10501
Fix color_ramp indexing negative elements
This commit is contained in:
commit
bb41e1427e
1 changed files with 2 additions and 2 deletions
|
@ -149,7 +149,7 @@ void Gradient::set_offset(int pos, const float offset) {
|
||||||
}
|
}
|
||||||
|
|
||||||
float Gradient::get_offset(int pos) const {
|
float Gradient::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?
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,7 @@ void Gradient::set_color(int pos, const Color &color) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Color Gradient::get_color(int pos) const {
|
Color Gradient::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?
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue