SharpLibEar/Manager.cs
changeset 262 c4749a27966d
parent 260 d44943088c67
child 265 82e87f4956ea
     1.1 --- a/SharpLibEar/Manager.cs	Tue Aug 30 21:14:18 2016 +0200
     1.2 +++ b/SharpLibEar/Manager.cs	Wed Aug 31 16:06:47 2016 +0200
     1.3 @@ -79,11 +79,13 @@
     1.4          {
     1.5              if (string.IsNullOrEmpty(aName))
     1.6              {
     1.7 -                //Just don't do that that would be silly
     1.8 +                //Just don't do that, that would be silly
     1.9                  return;
    1.10              }
    1.11 -            //Only trigger events matching the desired type
    1.12 -            foreach (Event e in Events.Where(e => e.Name.Equals(aName)))
    1.13 +            // Only trigger events matching the desired type
    1.14 +            // Doing some safety checks as well to prevent crashing if name was left null for some reason
    1.15 +            // This was the case when loading existing settings after event Name was introduced
    1.16 +            foreach (Event e in Events.Where(e => !string.IsNullOrEmpty(e.Name) && aName.Equals(e.Name)))
    1.17              {
    1.18                  await e.Trigger();
    1.19              }