diff --git a/src/index.cpp b/src/index.cpp
index ff347e3..0db871d 100644
--- a/src/index.cpp
+++ b/src/index.cpp
@@ -803,6 +803,10 @@ static void writeClassTreeForList(OutputList &ol,ClassSDict *cl,bool &started,FT
   for (;cli.current(); ++cli)
   {
     ClassDef *cd=cli.current();
+    if(!cd) // cli.current can return 0
+    {
+		continue;
+	}
     //printf("class %s hasVisibleRoot=%d isVisibleInHierarchy=%d\n",
     //             cd->name().data(),
     //              hasVisibleRoot(cd->baseClasses()),
