picaso / parrot-zik-status

A Mac interface for Zik Headphones
https://picaso.github.io/parrot-zik-status
MIT License
72 stars 19 forks source link

Fix crash on where services return nil #8

Closed shams-ahmed closed 8 years ago

shams-ahmed commented 8 years ago

services may return nil, swift does implicit unwrap which causes a crash on my system.

        @property   services
        @abstract   Gets an array of service records for the device.
        @discussion The resulting array contains IOBluetoothSDPServiceRecord objects.  The service records are only
                    present if an SDP query has been done on the target object.  This can be determined by calling
                    -getLastServicesUpdate.  It will return the last date/time of the SDP query. To initiate an
                    SDP query on a device, use -performSDPQuery: as defined above.

                    Instead of allowing individual clients to query for different services and service attributes,
                    the system request all of the device's services and service attributes.
        @result     Returns an array of service records for the device if an SDP query has been performed.  If no
                    SDP query has been performed, nil is returned.