Skip to content

Commit

Permalink
A malformed or broken addon page url will no longer crash Meldii when…
Browse files Browse the repository at this point in the history
… being opened
  • Loading branch information
Goomii authored and Goomii committed Jan 23, 2016
1 parent 8b869a1 commit d30731b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
8 changes: 8 additions & 0 deletions Meldii/Meldii.DataStructures/AddonMetaData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,14 @@ public void ReadFromIni(TextReader reader)
break;
case "url":
AddonPage = value;
// Valadate it
Uri uriResult;
bool isValidUrl = Uri.TryCreate(AddonPage, UriKind.Absolute, out uriResult) && (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps);
if (!isValidUrl)
{
AddonPage = "";
//Debug.Assert(false);
}
break;
case "source":
Source = value;
Expand Down
6 changes: 5 additions & 1 deletion Meldii/Meldii.Views/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,14 @@ public bool IsPendingVersionCheck
}
}

public void OnOpenAddonPage()
public async void OnOpenAddonPage()
{
if (SelectedAddon != null && SelectedAddon.AddonPage != null && SelectedAddon.AddonPage.Length > 0)
Process.Start(SelectedAddon.AddonPage);
else
{
await MainWindow.ShowMessageDialogYesNo("Error opening addon page", "Either this addon has no addon page set or it was a malformed url format");
}
}

public void OpenAddonLocation()
Expand Down
Binary file modified Release/Meldii.exe
Binary file not shown.

0 comments on commit d30731b

Please sign in to comment.