Skip to content

Commit 4543c38

Browse files
authored
address a Bad state: No element element exception (#321)
1 parent e14472f commit 4543c38

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pkgs/sdk_triage_bot/lib/triage.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,16 @@ Future<void> triage(
5151
String? lastComment;
5252
if (issue.hasComments) {
5353
final comments = await githubService.fetchIssueComments(sdkSlug, issue);
54-
final comment = comments.last;
55-
56-
lastComment = '''
54+
final comment = comments.lastOrNull;
55+
if (comment != null) {
56+
lastComment = '''
5757
---
5858
5959
Here is the last comment on the issue (by user @${comment.user?.login}):
6060
6161
${trimmedBody(comment.body ?? '')}
6262
''';
63+
}
6364
}
6465

6566
// decide if we should triage

0 commit comments

Comments
 (0)