compiler/ecs: Address Distributed Object issues with virtual methods
[sdk] / compiler / ecs / ecs.ec
index eeeb359..225f0d6 100644 (file)
@@ -1183,10 +1183,10 @@ static void BindDCOMClient()
                f.Printf("   }\n");
             }
             next = (Method)((BTNode)method).next;
-            while(next && ((next.type == virtualMethod) != doVirtual || (doVirtual && next.vid != vid)))
+            while((!next && doVirtual) || (next && ((next.type == virtualMethod) != doVirtual || (doVirtual && next.vid != vid))))
             {
                id++;
-               next = (Method)((BTNode)next).next;
+               next = next ? (Method)((BTNode)next).next : null;
                if(!next && doVirtual)
                {
                   if(vid == _class.vTblSize)