[Android] BrowserActivity: fix EmptyStackException

Jean-Baptiste Kempf git at videolan.org
Tue Apr 2 11:19:19 CEST 2013


vlc-ports/android | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Tue Apr  2 11:17:59 2013 +0200| [f57e113c94afe9fbf93abbcfedca89f11cbd69c5] | committer: Jean-Baptiste Kempf

BrowserActivity: fix EmptyStackException

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=f57e113c94afe9fbf93abbcfedca89f11cbd69c5
---

 vlc-android/src/org/videolan/vlc/gui/BrowserActivity.java |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/BrowserActivity.java b/vlc-android/src/org/videolan/vlc/gui/BrowserActivity.java
index 0721ace..b6b88da 100644
--- a/vlc-android/src/org/videolan/vlc/gui/BrowserActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/BrowserActivity.java
@@ -31,8 +31,6 @@ import org.videolan.vlc.Media;
 import org.videolan.vlc.R;
 import org.videolan.vlc.Util;
 
-import android.view.MenuItem;
-
 import android.app.AlertDialog;
 import android.app.ListActivity;
 import android.content.BroadcastReceiver;
@@ -44,9 +42,10 @@ import android.os.Bundle;
 import android.text.InputType;
 import android.view.ContextMenu;
 import android.view.ContextMenu.ContextMenuInfo;
-import android.widget.AdapterView.AdapterContextMenuInfo;
 import android.view.KeyEvent;
+import android.view.MenuItem;
 import android.view.View;
+import android.widget.AdapterView.AdapterContextMenuInfo;
 import android.widget.EditText;
 import android.widget.ListView;
 
@@ -233,9 +232,11 @@ public class BrowserActivity extends ListActivity {
             } else {
                 openDir(mCurrentDir.getParentFile());
                 // restore scroll state
-                ScrollState ss = mScollStates.pop();
-                getListView().setSelectionFromTop(ss.index, ss.top);
-                return true;
+                if (mScollStates.size() > 0) {
+                    ScrollState ss = mScollStates.pop();
+                    getListView().setSelectionFromTop(ss.index, ss.top);
+                    return true;
+                }
             }
         }
         return super.onKeyDown(keyCode, event);



More information about the Android mailing list