Null pointer check; gitignor for bodydata example.

* added a null pointer check
* gitignor was not set for bodydata example