Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix invoking on a nullable exception object in Picasso#deliverAction #2196

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bdpqchen
Copy link

I did not reproduce this crash #2158 , but found the code at Picasso#deliverAction(Exception e) which e is a Nullable parameter and use checkNotNull to check the parameter e , it is the main cause.

This PR create new RuntimeException when parameter e is a null value.

@JakeWharton
Copy link
Member

I would prefer to analyze the paths to this code and determine the underlying cause of the problem rather than ignoring it.

@bdpqchen
Copy link
Author

bdpqchen commented Feb 2, 2021

The version 2.71828 has this issue and master branch fixed

version 2.71828 :

BitmapHunter#run()
result = hunt();   // ① hunt() will return null bitmap and null exception when loading from a contact record which has no photo.
if (result == null) {
  dispatcher.dispatchFailed(this); // ② dispatch the null bitmap and null exception failed
} else {
  dispatcher.dispatchComplete(this);
}

ContactsPhotoRequestHandler#getInputStream()
case ID_CONTACT:
  return openContactPhotoInputStream(contentResolver, uri, true); // ③ return a null of InputStream

// and then Picasso#deliverAction(Bitmap, _,_, Exception)
action.error(e);
if (loggingEnabled) {
  log(OWNER_MAIN, VERB_ERRORED, action.request.logId(), e.getMessage()); // ④ e == null
}

master branch

ContactsPhotoRequestHandler#getSource() // throw an Exception when could not read a Source
 ?: throw FileNotFoundException("can't open input stream, uri: $uri")

I noticed that version 2.8 also has this issue, this PR could merge into version 2.9, and the readme should update to 2.9 currently 2.71828, then close that Issue.

@JakeWharton
Copy link
Member

There are no plans for any more 2.x releases. There are currently no plans to release master either, however. If you need this fix the best course of action is maintaining a fork.

@jrodbx jrodbx added this to the 3.0 milestone Jan 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants