From 7cd589972f23cfbf48cc13d8f24a0306a7014c08 Mon Sep 17 00:00:00 2001 From: David Rose Date: Thu, 13 Dec 2007 18:03:15 +0000 Subject: [PATCH] bugfix from Erik on forums --- panda/src/pgraph/lightAttrib.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/panda/src/pgraph/lightAttrib.cxx b/panda/src/pgraph/lightAttrib.cxx index 8ea29fc0b2..5ff6e304a9 100644 --- a/panda/src/pgraph/lightAttrib.cxx +++ b/panda/src/pgraph/lightAttrib.cxx @@ -522,8 +522,10 @@ filter_to_max(int max_lights) const { CompareLightPriorities()); // Now lop off all of the lights after the first max_lights. - priority_lights.erase(priority_lights.begin() + max_lights, - priority_lights.end()); + if (priority_lights.size() > max_lights) { + priority_lights.erase(priority_lights.begin() + max_lights, + priority_lights.end()); + } // Put the ambient lights back into the list. for (li = ambient_lights.begin(); li != ambient_lights.end(); ++li) {