diff --git a/src/dbusxmlscanner.cpp b/src/dbusxmlscanner.cpp
index e841428..aa3cc47 100644
--- a/src/dbusxmlscanner.cpp
+++ b/src/dbusxmlscanner.cpp
@@ -432,7 +432,7 @@ public:
             m_currentEnum = 0;
         }
 
-        if (EXTENSION("value"))
+        if (EXTENSION("value") && m_currentEnum)
         {
             CONDITION(!m_currentEntry, "end of value without start");
             m_currentEntry->endBodyLine = lineNumber();
