From: Mikko Rasa Date: Thu, 28 Nov 2013 12:24:11 +0000 (+0200) Subject: Check range when attaching Lights to a Lighting X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=f136af6873d7409daffe262b14f632af986bd7dc;p=libs%2Fgl.git Check range when attaching Lights to a Lighting --- 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);