Closed paramaggarwal closed 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.
@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.
-push
-addObject
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.