diff --git a/utils/fpdoc/dglobals.pp b/utils/fpdoc/dglobals.pp
index 9cb2ff55fd..16f30a9c54 100644
--- a/utils/fpdoc/dglobals.pp
+++ b/utils/fpdoc/dglobals.pp
@@ -1171,7 +1171,7 @@ var
   Module: TPasElement;
 begin
   Result := FindInModule(CurModule, AName);
-  if not Assigned(Result) then
+  if not Assigned(Result) and assigned (CurModule.InterfaceSection) then
     for i := CurModule.InterfaceSection.UsesList.Count - 1 downto 0 do
     begin
       Module := TPasElement(CurModule.InterfaceSection.UsesList[i]);