Skip to content

Commit 392d1c8

Browse files
committed
Handle case when no frontal face is included in face capture result
1 parent 7237c11 commit 392d1c8

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

app/src/main/java/com/appliedrec/credentials/app/IDCardActivity.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,11 @@ private void showResult(FaceCapture detectedFace) {
156156
@Override
157157
public void onSessionFinished(IVerIDSession<?> abstractVerIDSession, VerIDSessionResult verIDSessionResult) {
158158
if (!verIDSessionResult.getError().isPresent()) {
159-
verIDSessionResult.getFirstFaceCapture(Bearing.STRAIGHT).ifPresent(this::showResult);
159+
if (verIDSessionResult.getFirstFaceCapture(Bearing.STRAIGHT).isPresent()) {
160+
showResult(verIDSessionResult.getFirstFaceCapture(Bearing.STRAIGHT).get());
161+
} else {
162+
showError(R.string.failed_to_extract_frontal_face_image);
163+
}
160164
} else {
161165
showError(R.string.face_capture_failed);
162166
}

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,5 @@
5555
<string name="face_capture_failed">Face capture failed</string>
5656
<string name="failed_to_start_session">Failed to start session</string>
5757
<string name="failed_to_prepare_face_images">Failed to prepare face images</string>
58+
<string name="failed_to_extract_frontal_face_image">Failed to extract frontal face image</string>
5859
</resources>

0 commit comments

Comments
 (0)