Fix TypeError on __getDataKeys

Wrap the __getDataKeys function in a try/catch, and return an empty array if it is called on a non-object.