mirror of
https://github.com/2OOP/pism.git
synced 2026-02-04 10:54:51 +00:00
fixed incorrect index counting
This commit is contained in:
@@ -60,7 +60,7 @@ public abstract class ViewWidget extends StackWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void removeIndexFromPreviousChain(int index) {
|
public void removeIndexFromPreviousChain(int index) {
|
||||||
ViewWidget view = previous;
|
ViewWidget view = this;
|
||||||
|
|
||||||
while (index > 0 && view != null) {
|
while (index > 0 && view != null) {
|
||||||
index--;
|
index--;
|
||||||
@@ -76,15 +76,18 @@ public abstract class ViewWidget extends StackWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void removeViewFromPreviousChain(ViewWidget view) {
|
public void removeViewFromPreviousChain(ViewWidget view) {
|
||||||
|
ViewWidget prev = previous;
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
||||||
while (previous != null) {
|
while (prev != null) {
|
||||||
index++;
|
index++;
|
||||||
|
|
||||||
if (previous == view) {
|
if (prev == view) {
|
||||||
removeIndexFromPreviousChain(index);
|
removeIndexFromPreviousChain(index);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prev = prev.previous;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user