From 19f994b71209a0df0276acb12128b8de1c6d8fdc Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Tue, 19 Nov 2024 22:54:08 -0800 Subject: [PATCH] address an no element exception --- pkgs/sdk_triage_bot/lib/triage.dart | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkgs/sdk_triage_bot/lib/triage.dart b/pkgs/sdk_triage_bot/lib/triage.dart index a4a0cefe..6fa8f763 100644 --- a/pkgs/sdk_triage_bot/lib/triage.dart +++ b/pkgs/sdk_triage_bot/lib/triage.dart @@ -51,15 +51,16 @@ Future triage( String? lastComment; if (issue.hasComments) { final comments = await githubService.fetchIssueComments(sdkSlug, issue); - final comment = comments.last; - - lastComment = ''' + final comment = comments.lastOrNull; + if (comment != null) { + lastComment = ''' --- Here is the last comment on the issue (by user @${comment.user?.login}): ${trimmedBody(comment.body ?? '')} '''; + } } // decide if we should triage