diff --git a/src/vhdldocgen.cpp b/src/vhdldocgen.cpp
index d575398..370018f 100644
--- a/src/vhdldocgen.cpp
+++ b/src/vhdldocgen.cpp
@@ -944,6 +944,8 @@ MemberDef* VhdlDocGen::findFunction(const QList<Argument> &ql,
         for (;(arg=ali.current());++ali)
         {
           arg1=ali1.current(); ++ali1;
+          if(!arg1) // ali1.current() can return 0
+             return 0;
           equ+=abs(compareString(arg->type,arg1->type));
 
           QCString s1=arg->type;
