aboutsummaryrefslogtreecommitdiffstats
path: root/storage/filesystem/shallow.go
diff options
context:
space:
mode:
authorJP Sugarbroad <taralx@gmail.com>2017-06-23 11:11:23 -0700
committerGitHub <noreply@github.com>2017-06-23 11:11:23 -0700
commite6da93ce9ebd39c4fb0f38a225acc996a50e03ba (patch)
tree2efbda1618c29fe007bec46ba0b2619fdbecc22d /storage/filesystem/shallow.go
parentad02bf020460c210660db4fffda7f926b6aae95a (diff)
downloadgo-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/filesystem/shallow.go')
-rw-r--r--storage/filesystem/shallow.go2
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
}