Skip to content

Commit

Permalink
".." entry not always present
Browse files Browse the repository at this point in the history
  • Loading branch information
ultraq committed Jun 25, 2024
1 parent 34df5f8 commit 98fa42c
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ class EntryList implements EventTarget, ImGuiElement {
if (tableSortSpecs.specsDirty) {

// Take the special .. entry out to put back at the top after
var specialEntry = entries.remove(entries.findIndexOf { e -> e.name == '/..' || e.name == '..' })
var specialEntry = null
var specialEntryIndex = entries.findIndexOf { e -> e.name == '/..' || e.name == '..' }
if (specialEntryIndex != -1) {
specialEntry = entries.remove(specialEntryIndex)
}

var sortingColumn = tableSortSpecs.specs.columnIndex
switch (sortingColumn) {
Expand All @@ -90,7 +94,9 @@ class EntryList implements EventTarget, ImGuiElement {
entries.reverse(true)
}

entries.add(0, specialEntry)
if (specialEntry) {
entries.add(0, specialEntry)
}

tableSortSpecs.specsDirty = false
}
Expand Down

0 comments on commit 98fa42c

Please sign in to comment.