Add missing return to nullably-typed functions (flutter/engine#30382)

This commit is contained in:
Sam Rawlins
2021-12-20 14:53:19 -08:00
committed by GitHub
parent 8798882e6d
commit 33b26ff5a7
2 changed files with 15 additions and 12 deletions

View File

@@ -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.

View File

@@ -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')