Browse Source

bugfix from Erik on forums

David Rose 18 years ago
parent
commit
7cd589972f
1 changed files with 4 additions and 2 deletions
  1. 4 2
      panda/src/pgraph/lightAttrib.cxx

+ 4 - 2
panda/src/pgraph/lightAttrib.cxx

@@ -522,8 +522,10 @@ filter_to_max(int max_lights) const {
        CompareLightPriorities());
        CompareLightPriorities());
 
 
   // Now lop off all of the lights after the first max_lights.
   // 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.
   // Put the ambient lights back into the list.
   for (li = ambient_lights.begin(); li != ambient_lights.end(); ++li) {
   for (li = ambient_lights.begin(); li != ambient_lights.end(); ++li) {