From 65549dec105f93baf7cf2745d2d519eb50e78477 Mon Sep 17 00:00:00 2001 From: Olivier Poitrey Date: Sat, 12 Jun 2010 16:37:47 +0200 Subject: [PATCH] Better nil url handling --- UIImageView+WebCache.m | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/UIImageView+WebCache.m b/UIImageView+WebCache.m index 45fc65b7..24c7c493 100644 --- a/UIImageView+WebCache.m +++ b/UIImageView+WebCache.m @@ -23,14 +23,12 @@ // Remove in progress downloader from queue [manager cancelForDelegate:self]; - if (!url) + UIImage *cachedImage = nil; + if (url) { - self.image = nil; - return; + cachedImage = [manager imageWithURL:url]; } - UIImage *cachedImage = [manager imageWithURL:url]; - if (cachedImage) { self.image = cachedImage; @@ -42,7 +40,10 @@ self.image = placeholder; } - [manager downloadWithURL:url delegate:self]; + if (url) + { + [manager downloadWithURL:url delegate:self]; + } } }