From f136af6873d7409daffe262b14f632af986bd7dc Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Thu, 28 Nov 2013 14:24:11 +0200 Subject: [PATCH] Check range when attaching Lights to a Lighting --- source/lighting.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/lighting.cpp b/source/lighting.cpp index aae5d331..517530a2 100644 --- a/source/lighting.cpp +++ b/source/lighting.cpp @@ -1,7 +1,11 @@ +#include #include "light.h" #include "lighting.h" +#include "lightunit.h" #include "misc.h" +using namespace std; + namespace Msp { namespace GL { @@ -16,6 +20,9 @@ void Lighting::set_ambient(const Color &a) void Lighting::attach(unsigned i, const Light &l) { + if(i>=LightUnit::get_n_units()) + throw out_of_range("Lighting::attach"); + if(i>=lights.size()) lights.resize(i+1); -- 2.43.0