I am using the instagram API and if a caption doesnt exist or doesnt have text it doesnt include the node at all. So I included a check to see if caption exists which works, but if caption exists and the child node text does not, then I get the error: `Uncaught TypeError: Cannot read property 'text' of null`. 

This is my code:

```
for (p in pictures) {
  if (pictures[p].hasOwnProperty('caption')) {
    if (pictures[p].caption.text != null) {
      captionString = pictures[p].caption.text;
    }
  }
}

```