Added check to make sure the XML element is defined before referencing its attributes
Added check to make sure the XML element is defined before referencing its attributes

danianr/NINJa,danianr/NINJa,danianr/NINJa