瀏覽代碼

moved some code into try block for more defensive programming

Scrublord1336 6 年之前
父節點
當前提交
4453926036
共有 1 個文件被更改,包括 4 次插入4 次删除
  1. 4 4
      src/XUnity.AutoTranslator.Plugin.Core/Web/GoogleTranslateEndpoint.cs

+ 4 - 4
src/XUnity.AutoTranslator.Plugin.Core/Web/GoogleTranslateEndpoint.cs

@@ -64,12 +64,12 @@ namespace XUnity.AutoTranslator.Plugin.Core.Web
          {
             _isSettingUp = true;
 
-            var headers = new Dictionary<string, string>();
-            ApplyHeaders( headers );
-            object www = WwwConstructor.Invoke( new object[] { Settings.EnableSSL ? HttpsTranslateUserSite : HttpTranslateUserSite, null, headers } );
-
             try
             {
+               var headers = new Dictionary<string, string>();
+               ApplyHeaders( headers );
+               object www = WwwConstructor.Invoke( new object[] { Settings.EnableSSL ? HttpsTranslateUserSite : HttpTranslateUserSite, null, headers } );
+
                return www;
             }
             catch( Exception e )