adding a null check at handling Edit Photo result
This commit is contained in:
parent
bcdd8fe40f
commit
74140b1665
|
@ -94,7 +94,7 @@ class EditContactActivity : ContactActivity() {
|
|||
super.onActivityResult(requestCode, resultCode, resultData)
|
||||
if (resultCode == RESULT_OK) {
|
||||
when (requestCode) {
|
||||
INTENT_TAKE_PHOTO, INTENT_CHOOSE_PHOTO -> startCropPhotoIntent(lastPhotoIntentUri!!)
|
||||
INTENT_TAKE_PHOTO, INTENT_CHOOSE_PHOTO -> startCropPhotoIntent(lastPhotoIntentUri)
|
||||
INTENT_CROP_PHOTO -> updateContactPhoto(lastPhotoIntentUri.toString(), contact_photo)
|
||||
}
|
||||
}
|
||||
|
@ -190,7 +190,12 @@ class EditContactActivity : ContactActivity() {
|
|||
invalidateOptionsMenu()
|
||||
}
|
||||
|
||||
private fun startCropPhotoIntent(uri: Uri) {
|
||||
private fun startCropPhotoIntent(uri: Uri?) {
|
||||
if (uri == null) {
|
||||
toast(R.string.unknown_error_occurred)
|
||||
return
|
||||
}
|
||||
|
||||
lastPhotoIntentUri = getCachePhotoUri()
|
||||
Intent("com.android.camera.action.CROP").apply {
|
||||
setDataAndType(uri, "image/*")
|
||||
|
|
|
@ -35,7 +35,7 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
|
|||
|
||||
private val FIRST_CONTACT_ID = 1000000
|
||||
|
||||
private val mDb: SQLiteDatabase = writableDatabase
|
||||
private val mDb = writableDatabase
|
||||
|
||||
companion object {
|
||||
private const val DB_VERSION = 1
|
||||
|
|
Loading…
Reference in New Issue