summaryrefslogtreecommitdiff
path: root/src/com/android/browser/Controller.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/browser/Controller.java')
-rw-r--r--src/com/android/browser/Controller.java14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index 9683a474..c395935d 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -2569,8 +2569,11 @@ public class Controller
* returns the current tab if it can't advance
*/
private Tab getNextTab() {
- return mTabControl.getTab(Math.min(mTabControl.getTabCount() - 1,
- mTabControl.getCurrentPosition() + 1));
+ int pos = mTabControl.getCurrentPosition() + 1;
+ if (pos >= mTabControl.getTabCount()) {
+ pos = 0;
+ }
+ return mTabControl.getTab(pos);
}
/**
@@ -2578,8 +2581,11 @@ public class Controller
* returns the current tab if it can't advance
*/
private Tab getPrevTab() {
- return mTabControl.getTab(Math.max(0,
- mTabControl.getCurrentPosition() - 1));
+ int pos = mTabControl.getCurrentPosition() - 1;
+ if ( pos < 0) {
+ pos = mTabControl.getTabCount() - 1;
+ }
+ return mTabControl.getTab(pos);
}
/**