bug fixes

pull/3728/head
2dust 2023-04-12 20:15:17 +08:00
parent 92baf9025a
commit 6b12549cd9
3 changed files with 6 additions and 5 deletions

View File

@ -463,9 +463,9 @@ namespace v2rayN.Handler
}
if (lstProfile.Count > 0)
{
return SetDefaultServerIndex(ref config, lstProfile[0].indexId);
return SetDefaultServerIndex(ref config, lstProfile.Where(t => t.port > 0).FirstOrDefault()?.indexId);
}
return SetDefaultServerIndex(ref config, SqliteHelper.Instance.Table<ProfileItem>().Select(t => t.indexId).FirstOrDefault());
return SetDefaultServerIndex(ref config, SqliteHelper.Instance.Table<ProfileItem>().Where(t => t.port > 0).Select(t => t.indexId).FirstOrDefault());
}
public static ProfileItem? GetDefaultServer(ref Config config)
{
@ -1017,7 +1017,7 @@ namespace v2rayN.Handler
addStatus = AddVlessServer(ref config, profileItem, false);
}
if (addStatus == 0)
if (addStatus == 0 && profileItem.port > 0)
{
countServers++;
lstAdd.Add(profileItem);

View File

@ -910,7 +910,8 @@ namespace v2rayN.Handler
{
try
{
if (node == null)
if (node == null
|| node.port <= 0)
{
msg = ResUI.CheckServerSettings;
return -1;

View File

@ -10,7 +10,7 @@ namespace v2rayN.Handler
{
public sealed class MainFormHandler
{
private static readonly Lazy<MainFormHandler> instance = new(() => new());
private static readonly Lazy<MainFormHandler> instance = new(() => new());
public static MainFormHandler Instance => instance.Value;
public Icon GetNotifyIcon(Config config)