Skip to content

Commit

Permalink
Avoid passing a nullable value to Completer<nn-type>.completer.
Browse files Browse the repository at this point in the history
This is cleanup work required to start enforcing this with static analysis, as
per #53253.

Real quick this issue is that this code is unsafe:

```dart
void f(Completer<int> c, int? i) {
  Future<int>.value(i); // Ouch!
  c.complete(i);        // Ouch!
}
```

Change-Id: I91d7be0a16e62e78b530a70f115117d379259b9a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324541
Reviewed-by: Liam Appelbe <liama@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
  • Loading branch information
srawlins authored and Commit Queue committed Sep 6, 2023
1 parent ec70ca4 commit 14378ed
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/vm_service/test/common/test_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ class _ServiceTesteeLauncher {
blank = true;
}
if ((uri != null) && (blank == true) && (first == true)) {
completer.complete(uri);
completer.complete(uri!);
// Stop repeat completions.
first = false;
print('** Signaled to run test queries on $uri');
Expand Down

0 comments on commit 14378ed

Please sign in to comment.