am 2f9a1ce2: When checking the current playback position against the length of the file, make sure the length is valid. Otherwise we can end up endlessly (recursively) calling next(), and run out of stack.

Merge commit '2f9a1ce2f3b0ae72d698c240ce8448bc7cfe3a77'

* commit '2f9a1ce2f3b0ae72d698c240ce8448bc7cfe3a77':
  When checking the current playback position against the length
diff --git a/src/com/android/music/MediaPlaybackService.java b/src/com/android/music/MediaPlaybackService.java
index 6095c06..23ca124 100644
--- a/src/com/android/music/MediaPlaybackService.java
+++ b/src/com/android/music/MediaPlaybackService.java
@@ -976,8 +976,9 @@
     public void play() {
         if (mPlayer.isInitialized()) {
             // if we are at the end of the song, go to the next song first
-            if (mRepeatMode != REPEAT_CURRENT &&
-                mPlayer.position() >= mPlayer.duration() - 2000) {
+            long duration = mPlayer.duration();
+            if (mRepeatMode != REPEAT_CURRENT && duration > 2000 &&
+                mPlayer.position() >= duration - 2000) {
                 next(true);
             }