Use an empty string to if str was NULL.

This commit is contained in:
masarusanjp 2013-07-11 17:29:28 +09:00 committed by Olivier Poitrey
parent b3895a5124
commit 282e817919
1 changed files with 4 additions and 0 deletions

View File

@ -112,6 +112,10 @@ static const NSInteger kDefaultCacheMaxCacheAge = 60 * 60 * 24 * 7; // 1 week
- (NSString *)cachedFileNameForKey:(NSString *)key
{
const char *str = [key UTF8String];
if (str == NULL)
{
str = "";
}
unsigned char r[CC_MD5_DIGEST_LENGTH];
CC_MD5(str, (CC_LONG)strlen(str), r);
NSString *filename = [NSString stringWithFormat:@"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",