Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

prevent PackWriter from using Notify if nothing was written #543

Merged
merged 1 commit into from
Aug 10, 2017

Conversation

erizocosmico
Copy link
Contributor

@erizocosmico erizocosmico commented Aug 10, 2017

If PackWriter is not used, Close will call Notify even if the index is nil, which may cause a nil pointer dereference later down the line in the execution in ObjectStorage due to the insertion of nil indexes on the index.

An alternative fix if this is correct behavior would be to just check for nil indexes here:

w.Notify = func(h plumbing.Hash, idx *packfile.Index) {
s.index[h] = idx
}

@mcuadros mcuadros merged commit 7738417 into src-d:master Aug 10, 2017
@codecov
Copy link

codecov bot commented Aug 10, 2017

Codecov Report

Merging #543 into master will decrease coverage by 0.6%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #543      +/-   ##
==========================================
- Coverage   78.07%   77.47%   -0.61%     
==========================================
  Files         129      129              
  Lines        9792     9792              
==========================================
- Hits         7645     7586      -59     
- Misses       1316     1388      +72     
+ Partials      831      818      -13
Impacted Files Coverage Δ
storage/filesystem/internal/dotgit/writers.go 77.03% <0%> (ø) ⬆️
plumbing/transport/ssh/common.go 20.54% <0%> (-45.21%) ⬇️
plumbing/transport/ssh/auth_method.go 31.57% <0%> (-22.81%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 91868d1...94f43de. Read the comment docs.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants