BathyScapheで画像のインラインプレビューを可能にするプラグイン
| Revision | edef7ca3a1c56c83f4ff19664f4a8584668047bd (tree) |
|---|---|
| Time | 2012-08-05 23:23:43 |
| Author | masakih <masakih@user...> |
| Commiter | masakih |
[Fix] urlが正しく取得出来ない場合落ちるバグを修正
| @@ -168,7 +168,14 @@ NSRange fixRange(NSRange range, NSTextStorage *ts) | ||
| 168 | 168 | inRange:NSMakeRange(0, [ts length]) |
| 169 | 169 | options:NSAttributedStringEnumerationLongestEffectiveRangeNotRequired |
| 170 | 170 | usingBlock:^(id value, NSRange range, BOOL *stop) { |
| 171 | - NSURL *url = [NSURL URLWithString:value]; | |
| 171 | + NSURL *targetURL = nil; | |
| 172 | + if([value isKindOfClass:[NSString class]]) { | |
| 173 | + targetURL = [NSURL URLWithString:value]; | |
| 174 | + } | |
| 175 | + if([value isKindOfClass:[NSURL class]]) { | |
| 176 | + targetURL = value; | |
| 177 | + } | |
| 178 | + if(!targetURL) return; | |
| 172 | 179 | if([self.owner validateLink:url]) { |
| 173 | 180 | [links addObject:[NSDictionary dictionaryWithObjectsAndKeys:url, BSIPELinkKey, |
| 174 | 181 | NSStringFromRange(range), BSIPERangeKey, nil]]; |