From e6da93ce9ebd39c4fb0f38a225acc996a50e03ba Mon Sep 17 00:00:00 2001 From: JP Sugarbroad Date: Fri, 23 Jun 2017 11:11:23 -0700 Subject: storage/filesystem: Fix nil dereference in Shallow() This code crashes if the shallow file doesn't exist. --- storage/filesystem/shallow.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 } -- cgit