Skip to content

Commit

Permalink
Fix: A package website missing the http:// would crash...
Browse files Browse the repository at this point in the history
  • Loading branch information
leezer3 committed Jun 29, 2016
1 parent 96d0f3f commit 0ac5020
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion openBVE/OpenBve/UserInterface/formMain.Packages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -843,11 +843,23 @@ private void linkLabelPackageWebsite_Click(object sender, EventArgs e)
//Launch link in default web-browser
if (currentPackage != null && currentPackage.Website != null)
{
Process.Start(currentPackage.Website);
string launchLink = null;
if (!currentPackage.Website.ToLowerInvariant().StartsWith("http://"))
{
launchLink += "http://";
}
launchLink += currentPackage.Website;
Uri URL;
bool result = Uri.TryCreate(launchLink, UriKind.Absolute, out URL) && (URL.Scheme == Uri.UriSchemeHttp || URL.Scheme == Uri.UriSchemeHttps);
if (result == true)
{
Process.Start(launchLink);
}
}
}
}


private static DialogResult ShowInputDialog(ref string input)
{
System.Drawing.Size size = new System.Drawing.Size(200, 70);
Expand Down

0 comments on commit 0ac5020

Please sign in to comment.