Errata for array release?


I need to check the errata post, but in this exercise I was crashing without first setting the array to nil.


// Done with 'array' [array release];
Needed to be:

// Done with 'array' array = nil; [array release];

To get it to run cleanly.


Setting ‘array’ to nil before sending it a message will result in that message being sent to nil instead of to the object formerly pointed to by ‘array’, so your array will never get that release message.

Sending a message to nil is allowed, but that release message will not make it to the array.

Sometimes it can make sense to release and then set to nil. I don’t know if that would fix the problem, but setting to nil prior to sending the release message is almost certainly not what you want.