If you pass a string as parameter to the source= method and the image does not exist then application will crash later in the method because the proxy(UIImageView).image is nil and sending the size message to nil causes the crash. Suggest there needs to be a default 'image not found' image provided for all images that cannot be found.
def source=(source)
if @source != source
@source = source
image = case source
when String
UIImage.imageNamed(source)
when NSData
UIImage.imageWithData(source)
else
raise "Expected `String' or `NSData' object, got `#{source.class}'"
end
@original_image = proxy.image = image
if width.nan? and height.nan?
self.width = proxy.image.size.width
self.height = proxy.image.size.height
end
end
end
If you pass a string as parameter to the source= method and the image does not exist then application will crash later in the method because the proxy(UIImageView).image is nil and sending the size message to nil causes the crash. Suggest there needs to be a default 'image not found' image provided for all images that cannot be found.