Skip to content

Commit d940133

Browse files
Potential fix for code scanning alert no. 71: Nested 'if' statements can be combined
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 4699cae commit d940133

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/Caliburn.Micro.Platform/Platforms/Xamarin.Forms/AttachedCollection.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,8 @@ protected virtual void OnItemAdded(BindableObject item) {
5555
/// </summary>
5656
/// <param name="item">The item that was removed.</param>
5757
protected virtual void OnItemRemoved(BindableObject item) {
58-
if (item is IAttachedObject) {
59-
if (((IAttachedObject) item).AssociatedObject != null)
60-
((IAttachedObject) item).Detach();
58+
if (item is IAttachedObject && ((IAttachedObject) item).AssociatedObject != null) {
59+
((IAttachedObject) item).Detach();
6160
}
6261
}
6362

0 commit comments

Comments
 (0)