Whenever I release any instance that could exists or not, I am using this code:
if(myObject!=nil)
{
[myObject release];
}
but I have a confusion, sending a message to nil is not a problem;
I want to know, is that condition necessary?
Whenever I release any instance that could exists or not, I am using this code:
if(myObject!=nil)
{
[myObject release];
}
but I have a confusion, sending a message to nil is not a problem;
I want to know, is that condition necessary?
There is no need to check nil, because by default Objective C checks for nil,
So there is no need to check it twice.
but, you can do some extra code with that object here, before releasing the object.