Skip to content

Commit b2f96c7

Browse files
committed
io.appium.settings: recording: Add more null checks to solidify code
Signed-off-by: sirmordred <[email protected]>
1 parent 6a203ac commit b2f96c7

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

app/src/main/java/io/appium/settings/Settings.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,14 @@ && isHigherThanP()) {
108108
final MediaProjectionManager manager
109109
= (MediaProjectionManager) getSystemService(
110110
Context.MEDIA_PROJECTION_SERVICE);
111-
final Intent permissionIntent = manager.createScreenCaptureIntent();
111+
if (manager != null) {
112+
final Intent permissionIntent = manager.createScreenCaptureIntent();
112113

113-
startActivityForResult(permissionIntent,
114-
RecorderService.REQUEST_CODE_SCREEN_CAPTURE);
114+
startActivityForResult(permissionIntent,
115+
RecorderService.REQUEST_CODE_SCREEN_CAPTURE);
116+
} else {
117+
Log.e(TAG, "manager(MediaProjectionManager) null");
118+
}
115119
} else {
116120
finishActivity();
117121
}

0 commit comments

Comments
 (0)