Skip to content

Commit

Permalink
Fix bug where empty recent file causes panic due to referencing non-e…
Browse files Browse the repository at this point in the history
…xistent slice index of recent file data
  • Loading branch information
MatthewJohn committed Jun 7, 2024
1 parent f558e54 commit c9c8272
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/recent.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func unmarshalRecentFileData(recentFilePath string, recentFileData *RecentFile)
if err != nil {
logger.Errorf("Could not open recent versions file %q", recentFilePath)
}
if string(recentFileContent[0:1]) != "{" {
if len(string(recentFileContent)) >= 1 && string(recentFileContent[0:1]) != "{" {
convertOldRecentFile(recentFileContent, recentFileData)
} else {
err = json.Unmarshal(recentFileContent, &recentFileData)
Expand Down

0 comments on commit c9c8272

Please sign in to comment.