diff --git a/engine/src/networking/com/jme3/network/base/MessageListenerRegistry.java b/engine/src/networking/com/jme3/network/base/MessageListenerRegistry.java index f99342f83..cf9074bc0 100644 --- a/engine/src/networking/com/jme3/network/base/MessageListenerRegistry.java +++ b/engine/src/networking/com/jme3/network/base/MessageListenerRegistry.java @@ -96,6 +96,8 @@ public class MessageListenerRegistry implements MessageListener public void addMessageListener( MessageListener listener ) { + if( listener == null ) + throw new IllegalArgumentException( "Listener cannot be null." ); listeners.add(listener); } @@ -106,6 +108,8 @@ public class MessageListenerRegistry implements MessageListener public void addMessageListener( MessageListener listener, Class... classes ) { + if( listener == null ) + throw new IllegalArgumentException( "Listener cannot be null." ); for( Class c : classes ) { getListeners(c, true).add(listener); }