mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 20:15:21 +00:00
Fix Giphy crash
This commit is contained in:
parent
58c9b70c19
commit
a95da2c219
@ -14,7 +14,7 @@ public class ChunkedImageUrl implements Key {
|
||||
public static final long SIZE_UNKNOWN = -1;
|
||||
|
||||
private final String url;
|
||||
private final long size;
|
||||
private final long size;
|
||||
|
||||
public ChunkedImageUrl(@NonNull String url) {
|
||||
this(url, SIZE_UNKNOWN);
|
||||
@ -22,7 +22,7 @@ public class ChunkedImageUrl implements Key {
|
||||
|
||||
public ChunkedImageUrl(@NonNull String url, long size) {
|
||||
this.url = url;
|
||||
this.size = size;
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
@ -35,6 +35,7 @@ public class ChunkedImageUrl implements Key {
|
||||
|
||||
@Override
|
||||
public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) {
|
||||
if (url == null) { return; }
|
||||
messageDigest.update(url.getBytes());
|
||||
messageDigest.update(Conversions.longToByteArray(size));
|
||||
}
|
||||
@ -45,12 +46,14 @@ public class ChunkedImageUrl implements Key {
|
||||
|
||||
ChunkedImageUrl that = (ChunkedImageUrl)other;
|
||||
|
||||
if (this.url == null || that.url == null) { return false; }
|
||||
|
||||
return this.url.equals(that.url) && this.size == that.size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
if (url == null) { return 0; }
|
||||
return url.hashCode() ^ (int)size;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user