diff --git a/tui/tui.go b/tui/tui.go index 129a1401d..ac7715ace 100644 --- a/tui/tui.go +++ b/tui/tui.go @@ -215,15 +215,22 @@ func (ui *UI) rescanDir() { func (ui *UI) fileItemSelected(row, column int) { if ui.currentDir == nil { + return // Add this check to handle nil case + } + + selectedDirCell := ui.table.GetCell(row, column) + + // Check if the selectedDirCell is nil before using it + if selectedDirCell == nil || selectedDirCell.GetReference() == nil { return } - origDir := ui.currentDir - selectedDir := ui.table.GetCell(row, column).GetReference().(fs.Item) - if !selectedDir.IsDir() { + selectedDir := selectedDirCell.GetReference().(fs.Item) + if selectedDir == nil || !selectedDir.IsDir() { return } + origDir := ui.currentDir ui.currentDir = selectedDir ui.hideFilterInput() ui.markedRows = make(map[int]struct{})