Changed logic to avoid end value being shown twice

This commit is contained in:
Muhammad Zaheer 2022-10-16 16:53:14 +05:30 committed by Akos Kitta
parent 3476de27f7
commit cdaaa5584d

View File

@ -74,17 +74,15 @@ class HistoryList {
if (this.index !== this.end) {
this.traverse = true;
this.index = (++this.index < this.size) ? this.index : 0;
return this.ring[this.index];
if(this.index === this.end)
this.traverse = false;
}
else {
if (!this.traverse) {
return '';
}
else {
this.traverse = false;
return this.ring[this.index];
}
}
return this.ring[this.index];
}
}