Skip to content

Commit

Permalink
Fixed #80 causing AutoUpdater.NET to crash if the developer doesn't p…
Browse files Browse the repository at this point in the history
…rovide installer args in ParseUpdateInfoEvent.
  • Loading branch information
ravibpatel committed Jan 17, 2018
1 parent 68150c3 commit 1f29c33
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
12 changes: 6 additions & 6 deletions AutoUpdater.NET/AutoUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -362,13 +362,13 @@ private static void BackgroundWorkerDoWork(object sender, DoWorkEventArgs e)

XmlNode appArgs = item.SelectSingleNode("args");

args.InstallerArgs = appArgs?.InnerText ?? String.Empty;
args.InstallerArgs = appArgs?.InnerText;

XmlNode checksum = item.SelectSingleNode("checksum");

args.HashingAlgorithm = checksum?.Attributes["algorithm"]?.InnerText ?? "MD5";
args.HashingAlgorithm = checksum?.Attributes["algorithm"]?.InnerText;

args.Checksum = checksum?.InnerText ?? String.Empty;
args.Checksum = checksum?.InnerText;
}
}
}
Expand Down Expand Up @@ -402,9 +402,9 @@ private static void BackgroundWorkerDoWork(object sender, DoWorkEventArgs e)
ChangelogURL = args.ChangelogURL = GetURL(webResponse.ResponseUri, args.ChangelogURL);
DownloadURL = args.DownloadURL = GetURL(webResponse.ResponseUri, args.DownloadURL);
Mandatory = args.Mandatory;
InstallerArgs = args.InstallerArgs;
HashingAlgorithm = args.HashingAlgorithm;
Checksum = args.Checksum;
InstallerArgs = args.InstallerArgs ?? String.Empty;
HashingAlgorithm = args.HashingAlgorithm ?? "MD5";
Checksum = args.Checksum ?? String.Empty;

webResponse.Close();

Expand Down
3 changes: 2 additions & 1 deletion AutoUpdaterTest/FormMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ public FormMain()

private void FormMain_Load(object sender, EventArgs e)
{
//Uncomment below line to handle parsing logic of non XML AppCast file.
//Uncomment below lines to handle parsing logic of non XML AppCast file.

//AutoUpdater.ParseUpdateInfoEvent += AutoUpdaterOnParseUpdateInfoEvent;
//AutoUpdater.Start("http://rbsoft.org/updates/AutoUpdaterTest.json");

//Uncomment below line to run update process using non administrator account.

Expand Down

0 comments on commit 1f29c33

Please sign in to comment.