onStop Error, app shuts down
<p>I am trying to stop a melody from playing when user hit the back-button. This code is working when the file is playing, if not there will be an error and the app shuts down. How come it isnt working?</p>

<pre><code>MediaPlayer melodisnutt;
public void onStop() {
    super.onStop();
    if ( melodisnutt.isPlaying () ) {
        melodisnutt.stop();
    }
}
</code></pre>
