Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 545627b

Browse files
committed
Fix issue when changing to repo with no CloneUrl
Can't create a pull request session from a repository with no origin.
1 parent 77a6176 commit 545627b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/GitHub.InlineReviews/Services/PullRequestSessionManager.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,13 @@ async Task StatusChanged()
227227

228228
async Task<PullRequestSession> GetSessionInternal(string owner, string name, int number)
229229
{
230+
var cloneUrl = repository.CloneUrl;
231+
if (cloneUrl == null)
232+
{
233+
// Can't create a session from a repository with no origin
234+
return null;
235+
}
236+
230237
PullRequestSession session = null;
231238
WeakReference<PullRequestSession> weakSession;
232239
var key = Tuple.Create(owner.ToLowerInvariant(), number);
@@ -238,7 +245,7 @@ async Task<PullRequestSession> GetSessionInternal(string owner, string name, int
238245

239246
if (session == null)
240247
{
241-
var address = HostAddress.Create(repository.CloneUrl);
248+
var address = HostAddress.Create(cloneUrl);
242249
var pullRequest = await sessionService.ReadPullRequestDetail(address, owner, name, number);
243250

244251
session = new PullRequestSession(

0 commit comments

Comments
 (0)