Skip to content

Commit 0ee6250

Browse files
Resolve bug in Conversation Page (#8343)
1 parent a57c073 commit 0ee6250

1 file changed

Lines changed: 18 additions & 15 deletions

File tree

src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Conversation.cshtml

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -102,22 +102,25 @@
102102
{
103103
int indexA = Model.SampleLines.Count() - Math.Abs(revision.Key.sampleRevisionNumber - skipped);
104104
int indexB = int.Parse(thread.Comments.First().ElementId.Split("-").Last()) - 1;
105-
@if (thread.Comments.Any())
106-
{
107-
var elementId = thread.LineId;
105+
if (Model.SampleLines.Count() > indexA && Model.SampleLines.ElementAt(indexA).Count() > indexB)
106+
{
107+
@if (thread.Comments.Any())
108+
{
109+
var elementId = thread.LineId;
108110

109-
<tr class="code-line">
110-
<td class="code p-2" style="word-break: break-all;">
111-
<a class="comment-url" asp-page="Samples"
112-
asp-route-id=@Model.Review.Id
113-
asp-route-revisionId=@thread.Comments.First().ElementId.Split("-").First()
114-
asp-fragment=@Uri.EscapeDataString(elementId)>
115-
@Html.Raw(Model.SampleLines.ElementAt(indexA).ElementAt(indexB))
116-
</a>
117-
</td>
118-
</tr>
119-
}
120-
<partial name="_CommentThreadPartial" model="@thread" />
111+
<tr class="code-line">
112+
<td class="code p-2" style="word-break: break-all;">
113+
<a class="comment-url" asp-page="Samples"
114+
asp-route-id=@Model.Review.Id
115+
asp-route-revisionId=@thread.Comments.First().ElementId.Split("-").First()
116+
asp-fragment=@Uri.EscapeDataString(elementId)>
117+
@Html.Raw(Model.SampleLines.ElementAt(indexA).ElementAt(indexB))
118+
</a>
119+
</td>
120+
</tr>
121+
}
122+
<partial name="_CommentThreadPartial" model="@thread" />
123+
}
121124
}
122125
</table>
123126
</div>

0 commit comments

Comments
 (0)