Skip to content

Commit 631a5bd

Browse files
committed
fix bug
1 parent c879181 commit 631a5bd

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

FreeControl/Program.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System;
1+
using FreeControl.Utils;
2+
using System;
23
using System.Collections.Generic;
34
using System.Linq;
45
using System.Reflection;
@@ -18,7 +19,19 @@ static void Main()
1819

1920
Application.EnableVisualStyles();
2021
Application.SetCompatibleTextRenderingDefault(false);
21-
Application.Run(new Trusteeship());
22+
try
23+
{
24+
Application.Run(new Trusteeship());
25+
}
26+
catch (Exception ex)
27+
{
28+
Logger.Error(ex);
29+
DialogResult dr = MessageBox.Show("启动失败!是否要向开发者反馈此问题?", "提示", MessageBoxButtons.OKCancel);
30+
if (dr == DialogResult.OK)
31+
{
32+
System.Diagnostics.Process.Start("https://github.com/pdone/FreeControl/issues");
33+
}
34+
}
2235
}
2336
private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
2437
{

FreeControl/Utils/SysEnvironment.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ public static void SetPathAfter(string strHome)
7777
{
7878
string pathlist;
7979
pathlist = GetSysEnvironmentByName("PATH");
80+
if (string.IsNullOrWhiteSpace(pathlist))
81+
{
82+
return;
83+
}
8084
//检测是否以;结尾
8185
if (pathlist.Substring(pathlist.Length - 1, 1) != ";")
8286
{

0 commit comments

Comments
 (0)