what does "object data has been freed" mean when requesting object.children?

how would I test and except for it to handle it?

I would just do

else:

list=[]

does it do that if a object has no children?

It means you are accessing a game object that you deleted before.

Two solutions:
A) (the better one) ensure this does not happen - remove any references to objects that you delete (endObject) [there should not be any reference within the next game]
B) check if a reference is referring to an existing object with KX_GameObject.invalid