pr url error message
diff --git a/tool/lib/release_note_classes.dart b/tool/lib/release_note_classes.dart
index 08ad0dd..2f4f233 100644
--- a/tool/lib/release_note_classes.dart
+++ b/tool/lib/release_note_classes.dart
@@ -119,7 +119,11 @@
         final match = RegExp(
                 r'^https://github.com/flutter/devtools/pull/(?<pr_number>\d+)$')
             .firstMatch(url);
-        final prNumber = match!.namedGroup('pr_number');
+        if (match == null) {
+          throw Exception(
+              "Invalid github PR Url($url) found in message: $message}");
+        }
+        final prNumber = match.namedGroup('pr_number');
         prUrls.add('[#$prNumber]($url)');
       }
       markdown += ' - [](${prUrls.join(", ")})';