This is likely a bug. If a certain object, variable or attribute is empty it should not be returned. Instead, return an explicit empty.
Noncompliant example:
if $Object = empty
// guaranteed to be empty
then $Object/Attribute
else 'not found'
Compliant example:
if $Object = empty
then 'not found'
else $Object/Attribute