Skip to content

Commit

Permalink
chore: properly use DefaultIfEmpty consistently
Browse files Browse the repository at this point in the history
  • Loading branch information
rvazarkar committed Jul 22, 2024
1 parent ec85996 commit bb2abb2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/CommonLib/LdapUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1303,8 +1303,8 @@ public async Task<bool> IsDomainController(string computerObjectId, string domai
DomainName = resDomain,
Attributes = CommonProperties.ObjectID,
LDAPFilter = filter.GetFilter(),
}).DefaultIfEmpty(null).FirstOrDefaultAsync();
return result is { IsSuccess: true };
}).DefaultIfEmpty(LdapResult<IDirectoryObject>.Fail()).FirstOrDefaultAsync();
return result.IsSuccess;
}

public async Task<(bool Success, TypedPrincipal Principal)> ResolveDistinguishedName(string distinguishedName) {
Expand Down
4 changes: 2 additions & 2 deletions src/CommonLib/Processors/GPOLocalGroupProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ public async Task<ResultingGPOChanges> ReadGPOLocalGroups(string gpLink, string
SearchScope = SearchScope.Base,
Attributes = CommonProperties.GPCFileSysPath,
SearchBase = linkDn
}).DefaultIfEmpty(null).FirstOrDefaultAsync();
}).DefaultIfEmpty(LdapResult<IDirectoryObject>.Fail()).FirstOrDefaultAsync();

if (result is not { IsSuccess: true }) {
if (!result.IsSuccess) {
continue;
}

Expand Down

0 comments on commit bb2abb2

Please sign in to comment.