From bcc26f96ab03be46e0e45dda28c5b370c0ff7222 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Fri, 2 Nov 2018 23:06:19 -0500 Subject: [PATCH] Throwing error for incorrect vector size in RGBColor constructor. --- include/openmc/plot.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/openmc/plot.h b/include/openmc/plot.h index fa9ca171fd..f3e4826962 100644 --- a/include/openmc/plot.h +++ b/include/openmc/plot.h @@ -38,7 +38,9 @@ struct RGBColor { RGBColor(int r, int g, int b) : red(r), green(g), blue(b) { }; RGBColor(const std::vector &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];