Skip to content

Commit

Permalink
#16. Fixed a null pointer crash.
Browse files Browse the repository at this point in the history
  • Loading branch information
zionyx committed Jul 22, 2015
1 parent f7ed91f commit 95dde61
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion HudsonTrayTracker/UI/Controls/NotificationSettingsControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ protected override void OnLoad(EventArgs e)
if (DesignMode || Process.GetCurrentProcess().ProcessName == "devenv")
return;

configurationService = (ConfigurationService)ContextRegistry.GetContext().GetObject("ConfigurationService");
if (configurationService == null)
{
configurationService = (ConfigurationService)ContextRegistry.GetContext().GetObject("ConfigurationService");
}

statusLabel.Text = HudsonTrayTrackerResources.ResourceManager.GetString("NotificationSettings_" + Status);
SoundPath = configurationService.GetSoundPath(Status);
Expand Down Expand Up @@ -71,6 +74,11 @@ private void ChooseFile()

private void SetPath(string path)
{
if (configurationService == null)
{
configurationService = (ConfigurationService)ContextRegistry.GetContext().GetObject("ConfigurationService");
}

configurationService.SetSoundPath(Status, path);
SoundPath = path;
}
Expand Down

0 comments on commit 95dde61

Please sign in to comment.