mirror of
https://github.com/charmbracelet/glow
synced 2024-12-14 06:02:27 +00:00
Check for err before trying to access the stat struct
This commit is contained in:
parent
8c59f7c51d
commit
58c97dc8db
1 changed files with 2 additions and 2 deletions
4
main.go
4
main.go
|
@ -73,8 +73,8 @@ func readerFromArg(s string) (*Source, error) {
|
|||
}
|
||||
}
|
||||
|
||||
st, _ := os.Stat(s)
|
||||
if len(s) == 0 || st.IsDir() {
|
||||
st, err := os.Stat(s)
|
||||
if len(s) == 0 || (err == nil && st.IsDir()) {
|
||||
for _, v := range readmeNames {
|
||||
r, err := os.Open(filepath.Join(s, v))
|
||||
if err == nil {
|
||||
|
|
Loading…
Reference in a new issue