diff --git a/src/searchindex.cpp b/src/searchindex.cpp
index a550eb1..27674c2 100644
--- a/src/searchindex.cpp
+++ b/src/searchindex.cpp
@@ -444,7 +444,7 @@ SearchIndexExternal::~SearchIndexExternal()
 
 static QCString definitionToName(Definition *ctx)
 {
-  if (ctx->definitionType()==Definition::TypeMember)
+  if (ctx && ctx->definitionType()==Definition::TypeMember)
   {
     MemberDef *md = (MemberDef*)ctx;
     if (md->isFunction())
