Skip to content

Commit 78897ee

Browse files
authored
Merge pull request #972 from Caliburn-Micro/alert-autofix-82
Potential fix for code scanning alert no. 82: Missed opportunity to use Where
2 parents f692404 + 3dac33a commit 78897ee

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/Caliburn.Micro.Core/SimpleContainer.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,9 @@ public IEnumerable<object> GetAllInstances(Type service, string key = null)
181181

182182
var instances = currentEntry.Select(e => e(this));
183183

184-
foreach (var instance in instances)
184+
foreach (var instance in instances.Where(instance => EnablePropertyInjection && instance != null))
185185
{
186-
if (EnablePropertyInjection && instance != null)
187-
{
188-
BuildUp(instance);
189-
}
186+
BuildUp(instance);
190187
}
191188

192189
return instances;

0 commit comments

Comments
 (0)