mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-30 13:35:18 +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;
|
public static final long SIZE_UNKNOWN = -1;
|
||||||
|
|
||||||
private final String url;
|
private final String url;
|
||||||
private final long size;
|
private final long size;
|
||||||
|
|
||||||
public ChunkedImageUrl(@NonNull String url) {
|
public ChunkedImageUrl(@NonNull String url) {
|
||||||
this(url, SIZE_UNKNOWN);
|
this(url, SIZE_UNKNOWN);
|
||||||
@ -22,7 +22,7 @@ public class ChunkedImageUrl implements Key {
|
|||||||
|
|
||||||
public ChunkedImageUrl(@NonNull String url, long size) {
|
public ChunkedImageUrl(@NonNull String url, long size) {
|
||||||
this.url = url;
|
this.url = url;
|
||||||
this.size = size;
|
this.size = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUrl() {
|
public String getUrl() {
|
||||||
@ -35,6 +35,7 @@ public class ChunkedImageUrl implements Key {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) {
|
public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) {
|
||||||
|
if (url == null) { return; }
|
||||||
messageDigest.update(url.getBytes());
|
messageDigest.update(url.getBytes());
|
||||||
messageDigest.update(Conversions.longToByteArray(size));
|
messageDigest.update(Conversions.longToByteArray(size));
|
||||||
}
|
}
|
||||||
@ -45,12 +46,14 @@ public class ChunkedImageUrl implements Key {
|
|||||||
|
|
||||||
ChunkedImageUrl that = (ChunkedImageUrl)other;
|
ChunkedImageUrl that = (ChunkedImageUrl)other;
|
||||||
|
|
||||||
|
if (this.url == null || that.url == null) { return false; }
|
||||||
|
|
||||||
return this.url.equals(that.url) && this.size == that.size;
|
return this.url.equals(that.url) && this.size == that.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
|
if (url == null) { return 0; }
|
||||||
return url.hashCode() ^ (int)size;
|
return url.hashCode() ^ (int)size;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user