diff --git a/engine/src/core/com/jme3/export/SavableClassUtil.java b/engine/src/core/com/jme3/export/SavableClassUtil.java index 6a48ca3b8..5ef47ee3e 100644 --- a/engine/src/core/com/jme3/export/SavableClassUtil.java +++ b/engine/src/core/com/jme3/export/SavableClassUtil.java @@ -124,15 +124,21 @@ public class SavableClassUtil { public static int getSavedSavableVersion(Object savable, Class desiredClass, int[] versions){ Class thisClass = savable.getClass(); int count = 0; - while (thisClass != null && thisClass != desiredClass){ + + while (true) { thisClass = thisClass.getSuperclass(); - count ++; + if (thisClass != null && SavableClassUtil.isImplementingSavable(thisClass)){ + count ++; + }else{ + break; + } } + if (thisClass == null){ throw new IllegalArgumentException(savable.getClass().getName() + " does not extend " + desiredClass.getName() + "!"); - }else if (count > versions.length){ + }else if (count >= versions.length){ throw new IllegalArgumentException(savable.getClass().getName() + " cannot access version of " + desiredClass.getName() +