Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔧✨ Handle nil case for selectedDir and selectedDirCell (Interface Conversion Nil Error) #274

Merged
merged 1 commit into from
Feb 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions tui/tui.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{})
Expand Down
Loading