Added check for nil on peripheral name.
Changed 'undefined' to NSNull null as value of peripheral.name when nil.