Browse Source

A change from a while back that presents a slightly better
error message than an NPE but still isn't very helpful. This
usually only happens when things are totally confused, ie:
stream corruption or more likely misregistered classes.


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

PSp..om 14 years ago
parent
commit
8f90e62fec

+ 3 - 0
engine/src/networking/com/jme3/network/serializing/serializers/EnumSerializer.java

@@ -33,6 +33,7 @@
 package com.jme3.network.serializing.serializers;
 
 import com.jme3.network.serializing.Serializer;
+import com.jme3.network.serializing.SerializerException;
 import java.io.IOException;
 import java.nio.ByteBuffer;
 
@@ -48,6 +49,8 @@ public class EnumSerializer extends Serializer {
 
             if (ordinal == -1) return null;
             T[] enumConstants = c.getEnumConstants();
+            if (enumConstants == null)
+                throw new SerializerException( "Class has no enum constants:" + c );
             return enumConstants[ordinal];
         } catch (IndexOutOfBoundsException ex) {
             return null;