fix rare crash when resizing image in EditProfileActivity & prevent upscaling of image
This commit is contained in:
parent
5ebb057828
commit
1e7725a4a0
|
@ -442,10 +442,13 @@ class EditProfileActivity : BaseActivity() {
|
||||||
if (sourceBitmap == null) {
|
if (sourceBitmap == null) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
val bitmap = Bitmap.createScaledBitmap(sourceBitmap, resizeWidth, resizeHeight, true)
|
|
||||||
sourceBitmap.recycle()
|
//dont upscale image if its smaller than the desired size
|
||||||
if (bitmap == null) {
|
val bitmap =
|
||||||
return false
|
if(sourceBitmap.width <= resizeWidth && sourceBitmap.height <= resizeHeight) {
|
||||||
|
sourceBitmap
|
||||||
|
} else {
|
||||||
|
Bitmap.createScaledBitmap(sourceBitmap, resizeWidth, resizeHeight, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
resultBitmap = bitmap
|
resultBitmap = bitmap
|
||||||
|
|
Loading…
Reference in New Issue