Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 9910962

Browse files
author
Emmanuel Garcia
committed
handle null bitmap
1 parent 627e644 commit 9910962

File tree

1 file changed

+3
-0
lines changed
  • testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenariosui

1 file changed

+3
-0
lines changed

testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenariosui/ScreenshotUtil.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ public static void capture(@NonNull TestableFlutterActivity activity, @NonNull S
118118

119119
final Bitmap bitmap =
120120
InstrumentationRegistry.getInstrumentation().getUiAutomation().takeScreenshot();
121+
if (bitmap == null) {
122+
throw new RuntimeException("failed to capture screenshot");
123+
}
121124
final ByteArrayOutputStream out = new ByteArrayOutputStream();
122125
bitmap.compress(Bitmap.CompressFormat.PNG, 100, out);
123126
ScreenshotUtil.writeFile(captureName, out.toByteArray());

0 commit comments

Comments
 (0)