From 8f90e62fecddfbd9a27b7a4f4120516cda7c7286 Mon Sep 17 00:00:00 2001 From: "PSp..om" Date: Wed, 24 Aug 2011 09:38:28 +0000 Subject: [PATCH] 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 --- .../jme3/network/serializing/serializers/EnumSerializer.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engine/src/networking/com/jme3/network/serializing/serializers/EnumSerializer.java b/engine/src/networking/com/jme3/network/serializing/serializers/EnumSerializer.java index e3d87e8e0..f4e5ed3c3 100644 --- a/engine/src/networking/com/jme3/network/serializing/serializers/EnumSerializer.java +++ b/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;