Skip to content

Commit

Permalink
Bugfix invalid pumpdefinition.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
Elias Ruemmler committed Mar 7, 2019
1 parent e0adada commit 0808341
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions FlowCalc/Controller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,20 @@ public Controller()
#endregion Constructor

#region Services
public void LoadPump(string path)
public bool LoadPump(string path)
{
Pump = Pump.FromFile(path);
try
{
Pump = Pump.FromFile(path);
}
catch (Exception)
{
return false;
}


PumpDefinitionPath = path;
return true;
}

public double CalcFlowRate(double pressure)
Expand Down
2 changes: 1 addition & 1 deletion FlowCalc/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public Form1()
if (!string.IsNullOrWhiteSpace(Properties.Settings.Default.PumpDefinitionPath) &&
File.Exists(Properties.Settings.Default.PumpDefinitionPath))
{
m_Controller.LoadPump(Properties.Settings.Default.PumpDefinitionPath);
if (m_Controller.LoadPump(Properties.Settings.Default.PumpDefinitionPath))
applyPumpDefinition();
}
}
Expand Down

0 comments on commit 0808341

Please sign in to comment.