Skip to content

Commit

Permalink
Merge pull request #441 from gzliudan/fix-issue-440
Browse files Browse the repository at this point in the history
Fix panic during test (#440)
  • Loading branch information
gzliudan authored Feb 26, 2024
2 parents 06dc0ea + f11bf73 commit 8563ee3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions accounts/keystore/file_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (fc *fileCache) scan(keyDir string) (mapset.Set, mapset.Set, mapset.Set, er
if err != nil {
log.Warn("scan get FileInfo", "err", err, "path", path)
}
if skipKeyFile(fiInfo) {
if fiInfo == nil || skipKeyFile(fiInfo) {
log.Trace("Ignoring file on account scan", "path", path)
continue
}
Expand Down Expand Up @@ -94,7 +94,8 @@ func (fc *fileCache) scan(keyDir string) (mapset.Set, mapset.Set, mapset.Set, er
// skipKeyFile ignores editor backups, hidden files and folders/symlinks.
func skipKeyFile(fi os.FileInfo) bool {
// Skip editor backups and UNIX-style hidden files.
if strings.HasSuffix(fi.Name(), "~") || strings.HasPrefix(fi.Name(), ".") {
name := fi.Name()
if strings.HasSuffix(name, "~") || strings.HasPrefix(name, ".") {
return true
}
// Skip misc special files, directories (yes, symlinks too).
Expand Down

0 comments on commit 8563ee3

Please sign in to comment.