stop NSTimer causes error
<p>I used the codes below to stop a NSTimer</p>

<pre><code>-(void)stopTimer:(NSTimer*)timer;
{
    if(!timer) return;
    if([timer isValid])
    {

        [timer invalidate];
        timer = nil;

    }



}
</code></pre>

<p>sometimes it causes 'EXC Bad Access"</p>

<p>sometimes I got</p>

<pre><code> -[__NSCFType isValid]: unrecognized selector sent to instance 0x6298eb0
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFType isValid]: unrecognized selector sent to instance 0x6298eb0'
</code></pre>

<p>I think my codes has checked if the NSTimer is valid, if sure then executes 'invalidate'</p>

<p>Welcome any comment</p>
