There is no normal situation in which you should be using the fields of a CosObj directly.
If you want to see if an object is not null, use CosObjGetType(xxx) != CosNull, though in this case it would be better to do CosObjGetType(xxx) == CosDict.
This simple approach to looking for Kids is too simple... the Kids may have Kids, and grandchildren etc. I recommend you use PDNameTreeEnum.