diff options
author | JP Sugarbroad <taralx@gmail.com> | 2017-06-23 11:11:23 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-23 11:11:23 -0700 |
commit | e6da93ce9ebd39c4fb0f38a225acc996a50e03ba (patch) | |
tree | 2efbda1618c29fe007bec46ba0b2619fdbecc22d /storage | |
parent | ad02bf020460c210660db4fffda7f926b6aae95a (diff) | |
download | go-git-e6da93ce9ebd39c4fb0f38a225acc996a50e03ba.tar.gz |
storage/filesystem: Fix nil dereference in Shallow()
This code crashes if the shallow file doesn't exist.
Diffstat (limited to 'storage')
-rw-r--r-- | storage/filesystem/shallow.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/storage/filesystem/shallow.go b/storage/filesystem/shallow.go index ec8d20e..107818c 100644 --- a/storage/filesystem/shallow.go +++ b/storage/filesystem/shallow.go @@ -36,7 +36,7 @@ func (s *ShallowStorage) SetShallow(commits []plumbing.Hash) error { // Shallow return the shallow commits reading from shallo file from .git func (s *ShallowStorage) Shallow() ([]plumbing.Hash, error) { f, err := s.dir.Shallow() - if err != nil { + if f == nil || err != nil { return nil, err } |