Prevent TargetException when getting property value