Skip to content
This repository was archived by the owner on May 3, 2021. It is now read-only.

df_setImageWithResource: with nil url crashes the application #35

Closed
Quarezz opened this issue Jul 22, 2015 · 2 comments
Closed

df_setImageWithResource: with nil url crashes the application #35

Quarezz opened this issue Jul 22, 2015 · 2 comments
Assignees
Milestone

Comments

@Quarezz
Copy link

Quarezz commented Jul 22, 2015

DFImageManagerKit+UI.h


[self.imageViewIcon df_setImageWithResource:[NSURL URLWithString:data.imageUrl]];


Crashes here:

- (DFImageTask *)imageTaskForRequest:(DFImageRequest *)request completion:(DFImageRequestCompletion)completion {
    id<DFImageManaging> manager = DFManagerForRequest(request);
    if (!manager) {
        [NSException raise:NSInvalidArgumentException format:@"There are no managers that can handle the request %@", request];
    }
    return [manager imageTaskForRequest:request completion:completion];
}

Not really a bug, as I passed nil instead of NSURL, but still I think crashing is not the best choice.

@kean
Copy link
Owner

kean commented Jul 22, 2015

Not really a bug

Yep, the resource is annotated as nonnull
- (nullable DFImageTask *)df_setImageWithResource:(nonnull id)resource;

crashing is not the best choice

You are probably right, I think the UI components should be more forgiving. Thank you, I'll give it a thought.

@kean kean self-assigned this Jul 22, 2015
@kean kean added this to the 0.5.1 milestone Jul 22, 2015
@kean
Copy link
Owner

kean commented Jul 25, 2015

Done, DFImageView and UIImageView resource and request are now nullable

@kean kean closed this as completed Jul 25, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants