diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2017-08-21 22:27:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-21 22:27:34 +0200 |
commit | bb41e1427e5a0f88f8752d46425b778163868fe5 (patch) | |
tree | 773af46d83c4bfc62451ffc28b2afec20492fdb1 | |
parent | 328452e028480d85ea06de56eb46b36bc35f3424 (diff) | |
parent | 67b9d6eef2df5253657c89725195c58fe01b39f0 (diff) |
Merge pull request #10506 from hpvb/fix-10501
Fix color_ramp indexing negative elements
-rw-r--r-- | scene/resources/color_ramp.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/scene/resources/color_ramp.cpp b/scene/resources/color_ramp.cpp index 1825225abd..68f707220f 100644 --- a/scene/resources/color_ramp.cpp +++ b/scene/resources/color_ramp.cpp @@ -149,7 +149,7 @@ void Gradient::set_offset(int pos, const float offset) { } float Gradient::get_offset(int pos) const { - if (points.size() > pos) + if (points.size() && points.size() > pos) return points[pos].offset; 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 { - if (points.size() > pos) + if (points.size() && points.size() > pos) return points[pos].color; return Color(0, 0, 0, 1); //TODO: Maybe throw some error instead? } |