فهرست منبع

Fix crash in dndxc (#1494)

Vishal Sharma 7 سال پیش
والد
کامیت
1292901ee2
1فایلهای تغییر یافته به همراه14 افزوده شده و 7 حذف شده
  1. 14 7
      tools/clang/tools/dotnetc/EditorForm.cs

+ 14 - 7
tools/clang/tools/dotnetc/EditorForm.cs

@@ -3370,14 +3370,21 @@ namespace MainNs
             string resultText = "";
             string resultText = "";
             IDxcBlob source = null;
             IDxcBlob source = null;
             {
             {
-                var result = compiler.Compile(this.CreateBlobForCodeText(), fileName, fileVars.Entry, fileVars.Target, args, args.Length, null, 0, library.CreateIncludeHandler());
-                if (result.GetStatus() == 0)
-                {
-                    source = result.GetResult();
+                try
+                {
+                    var result = compiler.Compile(this.CreateBlobForCodeText(), fileName, fileVars.Entry, fileVars.Target, args, args.Length, null, 0, library.CreateIncludeHandler());
+                    if (result.GetStatus() == 0)
+                    {
+                        source = result.GetResult();
+                    }
+                    else
+                    {
+                        resultText = GetStringFromBlob(result.GetErrors());
+                    }
                 }
                 }
-                else
-                {
-                    resultText = GetStringFromBlob(result.GetErrors());
+                catch (System.ArgumentException e)
+                {
+                    MessageBox.Show(this, $"{e.Message}.", "Invalid form entry");
                 }
                 }
             }
             }
             return new HighLevelCompileResult() { Blob = source, ResultText = resultText };
             return new HighLevelCompileResult() { Blob = source, ResultText = resultText };