Throwing error for incorrect vector size in RGBColor constructor.

This commit is contained in:
Patrick Shriwise 2018-11-02 23:06:19 -05:00
parent 6de340e39a
commit bcc26f96ab

View file

@ -38,7 +38,9 @@ struct RGBColor {
RGBColor(int r, int g, int b) : red(r), green(g), blue(b) { };
RGBColor(const std::vector<int> &v) {
assert(v.size() == 3);
if (v.size() != 3) {
throw std::out_of_range("Incorrect vector size for RGBColor.");
}
red = v[0];
green = v[1];
blue = v[2];