Skip to content

Commit bd7cd20

Browse files
authored
Fix null reference when PR body is empty (#118)
1 parent 4adea85 commit bd7cd20

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

NuGetReleaseTool/NuGetReleaseTool/Helpers.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
using NuGetReleaseTool.GenerateInsertionChangelogCommand;
1+
using NuGet.Protocol.Plugins;
2+
using NuGetReleaseTool.GenerateInsertionChangelogCommand;
23
using Octokit;
4+
using System;
5+
using System.Collections.Generic;
36
using System.Text.RegularExpressions;
47

58
namespace NuGetReleaseTool
@@ -104,9 +107,18 @@ public static async Task<List<CommitWithDetails>> GetCommitDetails(GitHubClient
104107
{
105108
commit.PR = new Tuple<int, string>(id, @"https://github.com/nuget/nuget.client/pull/" + id);
106109
pullRequestbody = (await gitHubClient.Repository.PullRequest.Get(orgName, repoName, id)).Body;
110+
111+
}
112+
113+
if (pullRequestbody == null)
114+
{
115+
Console.WriteLine($"PR contains contains no body message: {commit?.PR?.Item2}");
116+
}
117+
else
118+
{
119+
UpdateCommitIssuesFromText(commit, pullRequestbody, issueRepositories);
107120
}
108121

109-
UpdateCommitIssuesFromText(commit, pullRequestbody, issueRepositories);
110122
processedCommits.Add(commit);
111123
}
112124

0 commit comments

Comments
 (0)