LIFX / LIFXKit

The LIFX SDK for Objective-C.
MIT License
122 stars 76 forks source link

Fix crash on unhandled StateService payload #26

Closed chendo closed 9 years ago

chendo commented 9 years ago

Not returning from an instancetype method is undefined behaviour, and in this instance it's returning a garbage pointer, resulting in "does not respond to selector" errors on random objects, and causing a crash. -Wswitch does not raise a warning because the all the possible values of the enum are handled.

The solution is to explicitly return nil if no match is found, and bail out if the return value of +LFXGatewayConnection gatewayConnectionWithGatewayDescriptor returns nil.

Closes #24.