Check for err before trying to access the stat struct

This commit is contained in:
Christian Muehlhaeuser 2019-12-07 08:31:15 +01:00
parent 8c59f7c51d
commit 58c97dc8db

View file

@ -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 {