From 2890490ab439b5e99cc7b81a656d4b4ef308aa20 Mon Sep 17 00:00:00 2001 From: Moxie Marlinspike Date: Wed, 6 Sep 2017 16:16:01 -0700 Subject: [PATCH] Support cameras that don't return data intent Fixes #6926 // FREEBIE --- src/org/thoughtcrime/securesms/CreateProfileActivity.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/org/thoughtcrime/securesms/CreateProfileActivity.java b/src/org/thoughtcrime/securesms/CreateProfileActivity.java index a7827ee564..34f58f15e7 100644 --- a/src/org/thoughtcrime/securesms/CreateProfileActivity.java +++ b/src/org/thoughtcrime/securesms/CreateProfileActivity.java @@ -119,17 +119,15 @@ public class CreateProfileActivity extends BaseActionBarActivity implements Inje switch (requestCode) { case REQUEST_CODE_AVATAR: - if (resultCode == Activity.RESULT_OK && data == null) { - Toast.makeText(this, R.string.CreateProfileActivity_error_capturing_photo_camera_did_not_return_image, Toast.LENGTH_LONG).show(); - } else if (resultCode == Activity.RESULT_OK) { + if (resultCode == Activity.RESULT_OK) { Uri outputFile = Uri.fromFile(new File(getCacheDir(), "cropped")); - Uri inputFile = data.getData(); + Uri inputFile = (data != null ? data.getData() : null); if (inputFile == null && captureFile != null) { inputFile = Uri.fromFile(captureFile); } - if (data.getBooleanExtra("delete", false)) { + if (data != null && data.getBooleanExtra("delete", false)) { avatarBytes = null; avatar.setImageDrawable(ContactPhotoFactory.getResourceContactPhoto(R.drawable.ic_camera_alt_white_24dp) .asDrawable(this, getResources().getColor(R.color.grey_400)));