• 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

修訂6c990dcacc895ec4f661d4ee180684fb18f8ad6a (tree)
時間2014-01-30 07:40:02
作者ANIKITI <anikiti07@gmai...>
CommiterANIKITI

Log Message

Twitter.CheckStatusCode メソッドで NullReferenceException がスローされる可能性がある問題を修正

Change Summary

差異

--- a/OpenTween/Twitter.cs
+++ b/OpenTween/Twitter.cs
@@ -3214,19 +3214,26 @@ namespace OpenTween
32143214 // 404エラーの挙動が変なので無視: https://dev.twitter.com/discussions/1213
32153215 if (httpStatus == HttpStatusCode.NotFound) return null;
32163216
3217- var callerMethod = new StackTrace(false).GetFrame(1).GetMethod().Name;
3217+ var callerMethod = new StackTrace(false).GetFrame(1).GetMethod();
3218+ var callerMethodName = callerMethod != null
3219+ ? callerMethod.Name
3220+ : "";
32183221
32193222 if (string.IsNullOrWhiteSpace(responseText))
32203223 {
32213224 if (httpStatus == HttpStatusCode.Unauthorized)
32223225 Twitter.AccountState = MyCommon.ACCOUNT_STATE.Invalid;
32233226
3224- return "Err:" + httpStatus + "(" + callerMethod + ")";
3227+ return "Err:" + httpStatus + "(" + callerMethodName + ")";
32253228 }
32263229
32273230 try
32283231 {
32293232 var errors = MyCommon.CreateDataFromJson<TwitterDataModel.ErrorResponse>(responseText).Errors;
3233+ if (errors == null || !errors.Any())
3234+ {
3235+ return "Err:" + responseText + "(" + callerMethodName + ")";
3236+ }
32303237
32313238 foreach (var error in errors)
32323239 {
@@ -3237,11 +3244,11 @@ namespace OpenTween
32373244 }
32383245 }
32393246
3240- return "Err:" + string.Join(",", errors.Select(x => x.ToString())) + "(" + callerMethod + ")";
3247+ return "Err:" + string.Join(",", errors.Select(x => x.ToString())) + "(" + callerMethodName + ")";
32413248 }
32423249 catch (SerializationException) { }
32433250
3244- return "Err:" + responseText + "(" + callerMethod + ")";
3251+ return "Err:" + responseText + "(" + callerMethodName + ")";
32453252 }
32463253
32473254 #region "UserStream"