Browse Source

Fix issue #2: Crash when update checking disabled.

pull/10/head
Daniel Grunwald 15 years ago
parent
commit
fd0250dc70
  1. 15
      ILSpy/AboutPage.cs

15
ILSpy/AboutPage.cs

@ -163,7 +163,12 @@ namespace ICSharpCode.ILSpy
{ {
XElement s = spySettings["UpdateSettings"]; XElement s = spySettings["UpdateSettings"];
this.automaticUpdateCheckEnabled = (bool?)s.Element("AutomaticUpdateCheckEnabled") ?? true; this.automaticUpdateCheckEnabled = (bool?)s.Element("AutomaticUpdateCheckEnabled") ?? true;
try {
this.LastSuccessfulUpdateCheck = (DateTime?)s.Element("LastSuccessfulUpdateCheck"); this.LastSuccessfulUpdateCheck = (DateTime?)s.Element("LastSuccessfulUpdateCheck");
} catch (FormatException) {
// avoid crashing on settings files invalid due to
// https://github.com/icsharpcode/ILSpy/issues/closed/#issue/2
}
} }
bool automaticUpdateCheckEnabled; bool automaticUpdateCheckEnabled;
@ -194,11 +199,11 @@ namespace ICSharpCode.ILSpy
public void Save() public void Save()
{ {
ILSpySettings.SaveSettings(new XElement( XElement updateSettings = new XElement("UpdateSettings");
"UpdateSettings", updateSettings.Add(new XElement("AutomaticUpdateCheckEnabled", automaticUpdateCheckEnabled));
new XElement("AutomaticUpdateCheckEnabled", automaticUpdateCheckEnabled), if (lastSuccessfulUpdateCheck != null)
new XElement("LastSuccessfulUpdateCheck", this.LastSuccessfulUpdateCheck) updateSettings.Add(new XElement("LastSuccessfulUpdateCheck", lastSuccessfulUpdateCheck));
)); ILSpySettings.SaveSettings(updateSettings);
} }
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;

Loading…
Cancel
Save