Browse Source

Some cheap defensive checks that make a nicer
(and more local in some cases) error for the caller.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9516 75d07b2b-3a1a-0410-a2c5-0572b91ccdca

PSp..om 13 years ago
parent
commit
11f686b1e0
1 changed files with 12 additions and 0 deletions
  1. 12 0
      engine/src/core/com/jme3/renderer/ViewPort.java

+ 12 - 0
engine/src/core/com/jme3/renderer/ViewPort.java

@@ -127,6 +127,9 @@ public class ViewPort {
      * @see SceneProcessor
      */
     public void addProcessor(SceneProcessor processor){
+        if (processor == null) {
+            throw new IllegalArgumentException( "Processor cannot be null." );
+        }
         processors.add(processor);
     }
 
@@ -140,6 +143,9 @@ public class ViewPort {
      * @see SceneProcessor
      */
     public void removeProcessor(SceneProcessor processor){
+        if (processor == null) {
+            throw new IllegalArgumentException( "Processor cannot be null." );
+        }
         processors.remove(processor);
         processor.cleanup();
     }
@@ -280,6 +286,9 @@ public class ViewPort {
      * @see Spatial
      */
     public void attachScene(Spatial scene){
+        if (scene == null) {
+            throw new IllegalArgumentException( "Scene cannot be null." );
+        }
         sceneList.add(scene);
     }
 
@@ -291,6 +300,9 @@ public class ViewPort {
      * @see #attachScene(com.jme3.scene.Spatial) 
      */
     public void detachScene(Spatial scene){
+        if (scene == null) {
+            throw new IllegalArgumentException( "Scene cannot be null." );
+        }
         sceneList.remove(scene);
     }