mirror of https://github.com/winsw/winsw
Refactoring: Null checks for getters in ServiceDescriptor (broken XmlDocument)
Signed-off-by: Oleg Nenashev <o.v.nenashev@gmail.com>pull/75/head
parent
9291ac911c
commit
b95f6f6d5c
|
@ -75,6 +75,7 @@ namespace winsw
|
|||
this.dom = dom;
|
||||
}
|
||||
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static ServiceDescriptor FromXML(string xml)
|
||||
{
|
||||
var dom = new XmlDocument();
|
||||
|
@ -357,7 +358,9 @@ namespace winsw
|
|||
{
|
||||
ArrayList serviceDependencies = new ArrayList();
|
||||
|
||||
foreach (XmlNode depend in dom.SelectNodes("//depend"))
|
||||
var xmlNodeList = dom.SelectNodes("//depend");
|
||||
if (xmlNodeList != null)
|
||||
foreach (XmlNode depend in xmlNodeList)
|
||||
{
|
||||
serviceDependencies.Add(depend.InnerText);
|
||||
}
|
||||
|
@ -470,7 +473,9 @@ namespace winsw
|
|||
get
|
||||
{
|
||||
List<Download> r = new List<Download>();
|
||||
foreach (XmlNode n in dom.SelectNodes("//download"))
|
||||
var xmlNodeList = dom.SelectNodes("//download");
|
||||
if (xmlNodeList != null)
|
||||
foreach (XmlNode n in xmlNodeList)
|
||||
{
|
||||
r.Add(new Download(n));
|
||||
}
|
||||
|
@ -483,7 +488,10 @@ namespace winsw
|
|||
get
|
||||
{
|
||||
List<SC_ACTION> r = new List<SC_ACTION>();
|
||||
foreach (XmlNode n in dom.SelectNodes("//onfailure"))
|
||||
var childNodes = dom.SelectNodes("//onfailure");
|
||||
if (childNodes != null)
|
||||
{
|
||||
foreach (XmlNode n in childNodes)
|
||||
{
|
||||
SC_ACTION_TYPE type;
|
||||
string action = n.Attributes["action"].Value;
|
||||
|
@ -504,6 +512,7 @@ namespace winsw
|
|||
XmlAttribute delay = n.Attributes["delay"];
|
||||
r.Add(new SC_ACTION(type, delay != null ? ParseTimeSpan(delay.Value) : TimeSpan.Zero));
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue