mRs- / HexColors

HexColors is an extension for UIColor and NSColor to support for creating colors from a hex strings
MIT License
457 stars 102 forks source link

Fix : adding defensive code. #29

Closed nicoaldegheri closed 8 years ago

mRs- commented 8 years ago

Is this really an issue? I mean, it should be natural that there is something wrong when you hand in a emtpy string ^_^

nicoaldegheri commented 8 years ago

You're right, this is not really a fix, this is more a improvement for my comfort and perhaps for other people ;-) I propose this change so that both methods (hx_colorWithHexString: and hx_colorWithHexString:alpha:) have the same behavior. Actually if you pass a nil or empty string to hx_colorWithHexString: the result is white color but if you do the same in hx_colorWithHexString:alpha: the result is nil and that is I think this is the right way to deal with nil argument :-)

mRs- commented 8 years ago

That's a point! It will be considered in 3.1.0

mRs- commented 8 years ago

Hey @nicoaldegheri I just created a new pull request (https://github.com/mRs-/HexColors/pull/30) for better nullability and a code cleanup