supermarin / ObjectiveSugar

ObjectiveC additions for humans. Ruby style.
MIT License
2.17k stars 190 forks source link

Check for nil before adding object to array #88

Closed paramaggarwal closed 10 years ago

paramaggarwal commented 10 years ago

If a nil object is added to an array, it causes an exception and the app will crash. Adding the object only based on a simple check prevents such errors and results in safer code.

supermarin commented 10 years ago

@paramaggarwal thanks for your contribution.

To stay as close to Cocoa behavior, I believe -push should behave similar as -addObject. That means, adding nil should blow up.