# Error Handling: property of non-object

**URL:** <https://forum.kirupa.com/t/error-handling-property-of-non-object/317077>\
**Category:** programming\
**Created:** [December 9, 2010, 5:55pm UTC](https://forum.kirupa.com/t/error-handling-property-of-non-object/317077 "2010-12-09T17:55:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![spyderfx](https://avatars.discourse-cdn.com/v4/letter/s/c2a13f/32.png) [@spyderfx](https://forum.kirupa.com/u/spyderfx)\
**Post date:** [December 9, 2010, 5:55pm UTC](https://forum.kirupa.com/t/error-handling-property-of-non-object/317077/1 "2010-12-09T17:55:24Z")

</div>

I’m trying to add error handling to my web app, but I’m a bit stumped on how to go about it for a simpleXML non object error.

This is the line the error occurs on.

```auto
$image = $item->ImageSets->ImageSet->SmallImage->URL;

```

It works 99% of the time, but some items return this line as an error. Everything I’ve tried keeps reporting the error in browser. How can I check if that code contains a non-object before the error is reported?

Thanks
