Index: src/xs/org/apache/ws/jaxme/xs/impl/XSAttributeImpl.java
===================================================================
RCS file: /home/cvs/ws-jaxme/src/xs/org/apache/ws/jaxme/xs/impl/XSAttributeImpl.java,v
retrieving revision 1.3
diff -u -r1.3 XSAttributeImpl.java
--- src/xs/org/apache/ws/jaxme/xs/impl/XSAttributeImpl.java	16 Feb 2004 23:39:43 -0000	1.3
+++ src/xs/org/apache/ws/jaxme/xs/impl/XSAttributeImpl.java	4 Dec 2004 23:13:16 -0000
@@ -129,11 +129,15 @@
     XSType myType;
     if (isReference()) {
       XSAttribute attribute = getXSSchema().getAttribute(getName());
+      attribute.validate();
       if (attribute == null) {
         throw new LocSAXException("Invalid attribute reference: No type named " + getName() + " defined.",
                                      getXsTAttribute().getLocator());
       }
       myType = attribute.getType();
+      if (myType == null) {
+          throw new IllegalStateException("The referenced attributes type must not be null.");
+      }
     } else if (isInnerSimpleType()) {
       XsTLocalSimpleType innerSimpleType = getXsTAttribute().getSimpleType();
       myType = getXSSchema().getXSObjectFactory().newXSType(this, innerSimpleType);
