Skip to content

Commit

Permalink
Fix NPE due to parameter made non-nullable during conversion
Browse files Browse the repository at this point in the history
Differential Revision: D50982505

fbshipit-source-id: d4875d50628366f371cf3429975c6a7f66123b3a
  • Loading branch information
ermattt2 authored and facebook-github-bot committed Nov 3, 2023
1 parent 3768bb1 commit 405e0a6
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -447,12 +447,12 @@ public DataSource<CloseableReference<PooledByteBuffer>> fetchEncodedImage(
* @return a DataSource that can safely be ignored.
*/
public DataSource<Void> prefetchToBitmapCache(
ImageRequest imageRequest, @Nullable Object callerContext) {
@Nullable ImageRequest imageRequest, @Nullable Object callerContext) {
return prefetchToBitmapCache(imageRequest, callerContext, null);
}

public DataSource<Void> prefetchToBitmapCache(
ImageRequest imageRequest,
@Nullable ImageRequest imageRequest,
@Nullable Object callerContext,
@Nullable RequestListener requestListener) {
try {
Expand All @@ -469,6 +469,7 @@ public DataSource<Void> prefetchToBitmapCache(
&& isInBitmapMemoryCache(imageRequest)) {
return DataSources.immediateSuccessfulDataSource();
}
Preconditions.checkNotNull(imageRequest);
final Boolean shouldDecodePrefetches = imageRequest.shouldDecodePrefetches();
final boolean skipBitmapCache =
shouldDecodePrefetches != null
Expand Down Expand Up @@ -722,7 +723,7 @@ public void clearCaches() {
* @param uri the uri for the image to be looked up.
* @return true if the image was found in the bitmap memory cache, false otherwise
*/
public boolean isInBitmapMemoryCache(final Uri uri) {
public boolean isInBitmapMemoryCache(@Nullable final Uri uri) {
if (uri == null) {
return false;
}
Expand All @@ -741,7 +742,7 @@ public MemoryCache<CacheKey, CloseableImage> getBitmapMemoryCache() {
* @param imageRequest the imageRequest for the image to be looked up.
* @return true if the image was found in the bitmap memory cache, false otherwise.
*/
public boolean isInBitmapMemoryCache(final ImageRequest imageRequest) {
public boolean isInBitmapMemoryCache(@Nullable final ImageRequest imageRequest) {
if (imageRequest == null) {
return false;
}
Expand All @@ -760,7 +761,7 @@ public boolean isInBitmapMemoryCache(final ImageRequest imageRequest) {
* @param uri the uri for the image to be looked up.
* @return true if the image was found in the encoded memory cache, false otherwise
*/
public boolean isInEncodedMemoryCache(final Uri uri) {
public boolean isInEncodedMemoryCache(@Nullable final Uri uri) {
if (uri == null) {
return false;
}
Expand All @@ -774,7 +775,7 @@ public boolean isInEncodedMemoryCache(final Uri uri) {
* @param imageRequest the imageRequest for the image to be looked up.
* @return true if the image was found in the encoded memory cache, false otherwise.
*/
public boolean isInEncodedMemoryCache(final ImageRequest imageRequest) {
public boolean isInEncodedMemoryCache(@Nullable final ImageRequest imageRequest) {
if (imageRequest == null) {
return false;
}
Expand Down

0 comments on commit 405e0a6

Please sign in to comment.