diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c
index a5b0cdd6ab651f7a84d5cba940276b8311464982..1cab886a4b07cadeebfd8b001be1f2946f6a9c5d 100644
--- a/dlls/oleaut32/typelib.c
+++ b/dlls/oleaut32/typelib.c
@@ -1939,6 +1939,8 @@ static int MSFT_CustData( TLBContext *pcx, int offset, struct list *custdata_lis
 
     TRACE_(typelib)("\n");
 
+    if (pcx->pTblDir->pCDGuids.offset < 0) return 0;
+
     while(offset >=0){
         count++;
         pNew=heap_alloc_zero(sizeof(TLBCustData));