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

Fixing Coverity Defects Part Deux #1130

wants to merge 5 commits into from

Conversation

whoisj
Copy link
@whoisj whoisj commented Jul 1, 2015

Another round of fixes for Coverity discovered defects.

Please closely review the NRE fixes, as there are likely better ways to resolve them that I have no considered.

@nulltoken nulltoken changed the title Fixing Coverity Defects Part Duex Fixing Coverity Defects Part Deux Jul 1, 2015
@@ -164,7 +169,7 @@ public virtual string Content
/// </summary>
/// <param name="patch"><see cref="Patch"/>.</param>
/// <returns>The patch content as string.</returns>
public static implicit operator string(Patch patch)
public static implicit operator string (Patch patch)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mono-style hits LibGit2Sharp for 42 damage points.

@whoisj
Copy link
Author
whoisj commented Jul 2, 2015

@Therzok update made, can you please re-review? 🙏

@Therzok
Copy link
Member
Therzok commented Jul 2, 2015

Looks good to me otherwise 👍

@whoisj
Copy link
Author
whoisj commented Jul 2, 2015

@Therzok 🙇 thank you sir.

@nulltoken you're up: what's your opinion about return -1 vs throw new InvalidOperationException in this situation?

@Therzok
Copy link
Member
Therzok commented Jul 8, 2015

This needs a rebase.

@whoisj
Copy link
Author
whoisj commented Jul 8, 2015

This needs a rebase.

Done. Not painful - sorry to disappoint 😜

@@ -66,6 +66,11 @@ private int PrintCallBack(GitDiffDelta delta, GitDiffHunk hunk, GitDiffLine line
PatchEntryChanges currentChange = this[filePath];
string prefix = string.Empty;

if (currentChange == null)
{
return (int)GitErrorCode.NotFound;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about. This will brutally flow back to libgit2.

Is there even a case when currentChange could actually be null?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8AE3

Is there even a case when currentChange could actually be null?

@nulltoken Coverity sure seems to think there is. Perhaps in some kind of repo corruption case? Not sure really. Null checking doesn't seem like a bad thing. Very little overhead and it would be correct to route and error back to the base lib if the value were null.

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

Successfully merging this pull request may close these issues.

3 participants
0