bennyguitar / Colours

A beautiful set of predefined colors and a set of color methods to make your iOS/OSX development life easier.
MIT License
3.09k stars 300 forks source link

EXC_BAD_ACCESS with NULL Pointer #22

Closed klaas closed 10 years ago

klaas commented 10 years ago

I've got a simple MKMapView and when I present an UIAlertView I get an EXC_BAD_ACCESS.

The swizzled method - (BOOL)colours_getHue:(CGFloat *)hue saturation:(CGFloat *)saturation brightness:(CGFloat *)brightness alpha:(CGFloat *)alpha; is called by the MapKit framework with an alpha pointer that is NULL. This leads to writing an alpha value to the address 0x00000000 .

I fixed it by testing the alpha pointer for NULL prior to setting its value:

if (alpha) {
    *alpha = a * 1.0;
}
bennyguitar commented 10 years ago

Hey can you open a pull request on this? I don't have time over the next few days to take a look and test, but it sounds serious.

klaas commented 10 years ago

Thanks, I'll create a pull request as soon as I can.

bennyguitar commented 10 years ago

Awesome, thanks @klass.