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
3.0
PSp..om 13 years ago
parent 332fe4d3ac
commit 11f686b1e0
  1. 12
      engine/src/core/com/jme3/renderer/ViewPort.java

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

Loading…
Cancel
Save