mirror of
https://github.com/oxen-io/session-android.git
synced 2025-06-09 20:58:34 +00:00
Prevented avatar read failures from crashing.
There are a handful of devices that refuse to use our AesGcmProvider, and as a result they would crash with AssertionErrors when downloading avatars. Still haven't found why, but for now, probably best to stop these devices from crashing, since it puts them in a crash loop, and the app is still usable without avatars.
This commit is contained in:
parent
4c30aa9f13
commit
ed5f5adc9b
@ -102,7 +102,12 @@ public class RetrieveProfileAvatarJob extends BaseJob implements InjectableType
|
|||||||
InputStream avatarStream = receiver.retrieveProfileAvatar(profileAvatar, downloadDestination, profileKey, MAX_PROFILE_SIZE_BYTES);
|
InputStream avatarStream = receiver.retrieveProfileAvatar(profileAvatar, downloadDestination, profileKey, MAX_PROFILE_SIZE_BYTES);
|
||||||
File decryptDestination = File.createTempFile("avatar", "jpg", context.getCacheDir());
|
File decryptDestination = File.createTempFile("avatar", "jpg", context.getCacheDir());
|
||||||
|
|
||||||
|
try {
|
||||||
Util.copy(avatarStream, new FileOutputStream(decryptDestination));
|
Util.copy(avatarStream, new FileOutputStream(decryptDestination));
|
||||||
|
} catch (AssertionError e) {
|
||||||
|
throw new IOException("Failed to copy stream. Likely a Conscrypt issue.", e);
|
||||||
|
}
|
||||||
|
|
||||||
decryptDestination.renameTo(AvatarHelper.getAvatarFile(context, recipient.getAddress()));
|
decryptDestination.renameTo(AvatarHelper.getAvatarFile(context, recipient.getAddress()));
|
||||||
} catch (PushNetworkException e) {
|
} catch (PushNetworkException e) {
|
||||||
if (e.getCause() instanceof NonSuccessfulResponseCodeException) {
|
if (e.getCause() instanceof NonSuccessfulResponseCodeException) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user