Skip to content

Commit

Permalink
Add missing return to nullably-typed functions (flutter#30382)
Browse files Browse the repository at this point in the history
  • Loading branch information
srawlins authored Dec 20, 2021
1 parent 8fabdda commit 63a223a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
2 changes: 2 additions & 0 deletions lib/web_ui/dev/steps/run_tests_step.dart
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ class RunTestsStep implements PipelineStep {
if (requireSkiaGold) {
throw ToolExit('Skia Gold is required but is unavailable.');
}

return null;
}

/// Checks whether the Skia Client is usable in this environment.
Expand Down
25 changes: 13 additions & 12 deletions lib/web_ui/lib/src/engine/safe_browser_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -200,19 +200,20 @@ html.CanvasElement? tryCreateCanvasElement(int width, int height) {
'createElement',
<dynamic>['CANVAS'],
);
if (canvas != null) {
try {
canvas.width = width;
canvas.height = height;
} catch (e) {
// It seems the tribal knowledge of why we anticipate an exception while
// setting width/height on a non-null canvas and why it's OK to return
// null in this case has been lost. Kudos to the one who can recover it
// and leave a proper comment here!
return null;
}
return canvas;
if (canvas == null) {
return null;
}
try {
canvas.width = width;
canvas.height = height;
} catch (e) {
// It seems the tribal knowledge of why we anticipate an exception while
// setting width/height on a non-null canvas and why it's OK to return null
// in this case has been lost. Kudos to the one who can recover it and leave
// a proper comment here!
return null;
}
return canvas;
}

@JS('window.ImageDecoder')
Expand Down

0 comments on commit 63a223a

Please sign in to comment.