Check that there are some methods to iterate through before iterating
authorVincent Béron <vberon@mecano.gme.usherb.ca>
Mon, 31 Jan 2005 11:30:26 +0000 (11:30 +0000)
committerAlexandre Julliard <julliard@winehq.org>
Mon, 31 Jan 2005 11:30:26 +0000 (11:30 +0000)
through them.

tools/widl/write_msft.c

index b32ffc7d7a2191923ef5d1b897c53883470f0eee..eaccf0b1b1fbac93a5f99892a1e3730118e73d67 100644 (file)
@@ -1618,12 +1618,13 @@ static void add_interface_typeinfo(msft_typelib_t *typelib, type_t *interface)
     msft_typeinfo->typeinfo->datatype2 = num_funcs << 16 | num_parents;
     msft_typeinfo->typeinfo->cbSizeVft = num_funcs * 4;
 
-    func = interface->funcs;
-    while(NEXT_LINK(func)) func = NEXT_LINK(func);
-    while(func) {
-        if(add_func_desc(msft_typeinfo, func, idx) == S_OK)
-            idx++;
-        func = PREV_LINK(func);
+    if((func = interface->funcs)) {
+        while(NEXT_LINK(func)) func = NEXT_LINK(func);
+        while(func) {
+            if(add_func_desc(msft_typeinfo, func, idx) == S_OK)
+                idx++;
+            func = PREV_LINK(func);
+        }
     }
 }