Skip to content
This repository was archived by the owner on Oct 23, 2025. It is now read-only.

Commit 35c888e

Browse files
author
vlOd
committed
Fix an issue where msgboxes would crash the application + Make UPnP issues not prevent calls
1 parent 35dff96 commit 35c888e

5 files changed

Lines changed: 18 additions & 13 deletions

File tree

Pinto.sln

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ VisualStudioVersion = 16.0.33529.622
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pinto", "Pinto\Pinto.csproj", "{3C666CE0-2F98-4C12-8B7D-AF1AFC5480B8}"
77
EndProject
8-
Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "PintoSetup", "PintoSetup\PintoSetup.vdproj", "{FA82007F-4B1C-4E32-ACE1-5376DBF39028}"
9-
EndProject
108
Global
119
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1210
Build|x64 = Build|x64
@@ -17,8 +15,6 @@ Global
1715
{3C666CE0-2F98-4C12-8B7D-AF1AFC5480B8}.Build|x64.Build.0 = Build|x64
1816
{3C666CE0-2F98-4C12-8B7D-AF1AFC5480B8}.Build|x86.ActiveCfg = Build|x86
1917
{3C666CE0-2F98-4C12-8B7D-AF1AFC5480B8}.Build|x86.Build.0 = Build|x86
20-
{FA82007F-4B1C-4E32-ACE1-5376DBF39028}.Build|x64.ActiveCfg = Build
21-
{FA82007F-4B1C-4E32-ACE1-5376DBF39028}.Build|x86.ActiveCfg = Build
2218
EndGlobalSection
2319
GlobalSection(SolutionProperties) = preSolution
2420
HideSolutionNode = FALSE

Pinto/Forms/CallManager.cs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,20 @@ private void Start(string ip)
120120
"Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
121121
else
122122
{
123-
routerMapping = router.StaticPortMappingCollection.Add(PORT, "UDP",
124-
PORT, GetAllLocalIPv4(NetworkInterfaceType.Ethernet)
125-
.FirstOrDefault(), true, "UDPAudio");
126-
lExternalIP.Text = $"External IP: {routerMapping.ExternalIPAddress}";
123+
try
124+
{
125+
routerMapping = router.StaticPortMappingCollection.Add(PORT, "UDP",
126+
PORT, GetAllLocalIPv4(NetworkInterfaceType.Ethernet)
127+
.FirstOrDefault(), true, "UDPAudio");
128+
lExternalIP.Text = $"External IP: {routerMapping.ExternalIPAddress}";
129+
}
130+
catch (Exception ex)
131+
{
132+
MessageBox.Show($"Unable to use UPnP to open the listen port:" +
133+
$"{Environment.NewLine}{ex}{Environment.NewLine}{Environment.NewLine}" +
134+
$"Please do not report this issue, as UPnP support in C# is very unstable",
135+
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
136+
}
127137
}
128138

129139
tCall.Start();

Pinto/Forms/MsgBox/MsgBox.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public static void ShowNotification(Form parent, string body, string title = "No
4141
break;
4242
}
4343

44-
if (parent.WindowState != FormWindowState.Normal) parent = null;
44+
if (parent != null && parent.WindowState != FormWindowState.Normal) parent = null;
4545
notification.StartPosition = parent == null ?
4646
FormStartPosition.CenterScreen : FormStartPosition.CenterParent;
4747

@@ -93,7 +93,7 @@ public static void ShowPromptNotification(Form parent, string body, string title
9393
break;
9494
}
9595

96-
if (parent.WindowState != FormWindowState.Normal) parent = null;
96+
if (parent != null && parent.WindowState != FormWindowState.Normal) parent = null;
9797
notification.StartPosition = parent == null ?
9898
FormStartPosition.CenterScreen : FormStartPosition.CenterParent;
9999

Pinto/Pinto.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@
3535
<StartupObject />
3636
</PropertyGroup>
3737
<PropertyGroup>
38-
<ApplicationIcon>
39-
</ApplicationIcon>
38+
<ApplicationIcon>Resources\Logo\LOGO.ico</ApplicationIcon>
4039
</PropertyGroup>
4140
<PropertyGroup />
4241
<PropertyGroup />

Pinto/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace PintoNS
1313
public static class Program
1414
{
1515
public static ConsoleForm Console;
16-
public const string VERSION_STRING = "exp1";
16+
public const string VERSION_STRING = "exp0";
1717
public const int PROTOCOL_VERSION = 0;
1818

1919
[STAThread]

0 commit comments

Comments
 (0)