• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

dev


Commit MetaInfo

修訂3ca44dd8a7ae4a953ccc8cff34d130cd93e4b5c3 (tree)
時間2013-11-07 00:05:43
作者Kimura Youichi <kim.upsilon@bucy...>
CommiterKimura Youichi

Log Message

プロフィール画像の読み込みに係わる例外処理を修正

Change Summary

差異

--- a/OpenTween/ImageCache.cs
+++ b/OpenTween/ImageCache.cs
@@ -112,20 +112,16 @@ namespace OpenTween
112112 {
113113 var imageTask = client.DownloadDataAsync(new Uri(address), cancelToken).ContinueWith(t =>
114114 {
115- if (t.Exception != null)
115+ if (t.IsFaulted)
116+ {
116117 t.Exception.Handle(e => e is WebException);
118+ return null;
119+ }
117120
118121 if (t.Status != TaskStatus.RanToCompletion)
119122 return null;
120123
121- try
122- {
123- return MemoryImage.CopyFromBytes(t.Result);
124- }
125- catch (InvalidImageException) // 画像形式が不正
126- {
127- return null;
128- }
124+ return MemoryImage.CopyFromBytes(t.Result);
129125 }, cancelToken);
130126
131127 this.innerDictionary[address] = imageTask;
--- a/OpenTween/ImageListViewItem.cs
+++ b/OpenTween/ImageListViewItem.cs
@@ -62,9 +62,13 @@ namespace OpenTween
6262 {
6363 return this.imageCache.DownloadImageAsync(this.imageUrl, force).ContinueWith(t =>
6464 {
65- var image = t.Result;
65+ if (t.IsFaulted)
66+ {
67+ t.Exception.Handle(x => x is InvalidImageException);
68+ return;
69+ }
6670
67- if (image == null) return;
71+ var image = t.Result;
6872
6973 this._ImageReference.Target = image;
7074
@@ -84,7 +88,7 @@ namespace OpenTween
8488 }
8589 }));
8690 }
87- }, TaskContinuationOptions.OnlyOnRanToCompletion);
91+ });
8892 }
8993
9094 public MemoryImage Image