diff --git a/src/xercesc/validators/schema/TraverseSchema.cpp b/src/xercesc/validators/schema/TraverseSchema.cpp
index 330f288afb3e1a729c2418c84734ad8e97ed0ad9..24020f1b2d14e4df741263efd752d2129cf78154 100644
--- a/src/xercesc/validators/schema/TraverseSchema.cpp
+++ b/src/xercesc/validators/schema/TraverseSchema.cpp
@@ -5856,6 +5856,10 @@ void TraverseSchema::checkMinMax(ContentSpecNode* const specNode,
         }
     }
 
+    if (minOccurs == 0 && maxOccurs == 0){
+        return;
+    }
+
     // Constraint checking for min/max value
     if (!isMaxUnbounded) {
 
@@ -5880,10 +5884,6 @@ void TraverseSchema::checkMinMax(ContentSpecNode* const specNode,
         }
     }
 
-    if (minOccurs == 0 && maxOccurs == 0){
-        return;
-    }
-
     // Constraint checking for 'all' content
     bool isAllElement = (allContextFlag == All_Element);
     bool isAllGroup = (allContextFlag == All_Group);