8000 Fixing Coverity Defects Part Deux by whoisj · Pull Request #1130 · libgit2/libgit2sharp · GitHub
[go: up one dir, main page]

Skip to content

Fixing Coverity Defects Part Deux #1130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Resolves a NRE condition defect found by Coverity by adding an assert…
… where the issues can occur.
  • Loading branch information
J Wyman committed Jul 8, 2015
commit a94bb907dba3b84226e3332cfae1a148975b850e
3 changes: 3 additions & 0 deletions LibGit2Sharp/Core/HistoryRewriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ private Reference RewriteReference<TRef, TTarget>(
Reference newRef = updateTarget(repo.Refs, oldRef, newTarget, "filter-branch: rewrite");
rollbackActions.Enqueue(() => updateTarget(repo.Refs, oldRef, oldRefTarget, "filter-branch: abort"));

// Make Coverity happy by validating reference in debug builds
Debug.Assert(newRef != null);

if (newRef.CanonicalName == newRefName)
{
return refMap[oldRef] = newRef;
Expand Down
0