From 7838a787df4ce4d8be3c68df41e02942658b5bc2 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Wed, 25 Feb 2015 22:27:38 -0500 Subject: [PATCH] Fix a bug in app removal --- app/src/main/java/com/limelight/AppView.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/limelight/AppView.java b/app/src/main/java/com/limelight/AppView.java index 89e6891c..5ec10b46 100644 --- a/app/src/main/java/com/limelight/AppView.java +++ b/app/src/main/java/com/limelight/AppView.java @@ -398,7 +398,8 @@ public class AppView extends Activity implements AdapterFragmentCallbacks { } // Next handle app removals - for (int i = 0; i < appGridAdapter.getCount(); i++) { + int i = 0; + while (i < appGridAdapter.getCount()) { boolean foundExistingApp = false; AppObject existingApp = (AppObject) appGridAdapter.getItem(i); @@ -414,7 +415,14 @@ public class AppView extends Activity implements AdapterFragmentCallbacks { if (!foundExistingApp) { appGridAdapter.removeApp(existingApp); updated = true; + + // Check this same index again because the item at i+1 is now at i after + // the removal + continue; } + + // Move on to the next item + i++; } if (updated) {