Skip to content

Commit 3dc507e

Browse files
authored
Merge pull request #576 from PratyushBalaji/fix_wsl_crash_on_search
Fix crash when searching on WSL mounted drives
2 parents 2449fee + 705e215 commit 3dc507e

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/internal/function.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,18 +143,18 @@ func returnFolderElementBySearchString(location string, displayDotFile bool, sea
143143
items, err := os.ReadDir(location)
144144
if err != nil {
145145
outPutLog("Return folder element function error", err)
146+
return []element{}
146147
}
147148

148149
folderElementMap := map[string]element{}
149150
fileAndDirectories := []string{}
150151

151152
for _, item := range items {
152-
fileInfo, _ := item.Info()
153-
if !displayDotFile && strings.HasPrefix(fileInfo.Name(), ".") {
153+
fileInfo, err := item.Info()
154+
if err != nil {
154155
continue
155156
}
156-
157-
if fileInfo == nil {
157+
if !displayDotFile && strings.HasPrefix(fileInfo.Name(), ".") {
158158
continue
159159
}
160160

@@ -169,7 +169,6 @@ func returnFolderElementBySearchString(location string, displayDotFile bool, sea
169169
directory: item.IsDir(),
170170
location: folderElementLocation,
171171
}
172-
173172
}
174173

175174
var options = fzf.DefaultOptions()

0 commit comments

Comments
 (0)