Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ MSAL Wiki : https://github.com/AzureAD/microsoft-authentication-library-for-andr

vNext
----------
- [PATCH] Add null checks for guest account ids (#2361)

Version 7.0.1
----------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,23 @@ private static class GuestAccountFilter implements CacheRecordFilter {

@Override
public List<ICacheRecord> filter(@NonNull List<ICacheRecord> records) {
final String methodTag = TAG + ":GuestAccountFilter";
final List<ICacheRecord> result = new ArrayList<>();

for (final ICacheRecord cacheRecord : records) {
final String acctHomeAccountId = cacheRecord.getAccount().getHomeAccountId();
final String acctLocalAccountId = cacheRecord.getAccount().getLocalAccountId();
boolean isValid = true;

if (!acctHomeAccountId.contains(acctLocalAccountId)) {
if (acctHomeAccountId == null) {
Logger.warn(methodTag, "Home account ID is null for entry.");
isValid = false;
}
if (acctLocalAccountId == null) {
Logger.warn(methodTag, "Local account ID is null for entry.");
isValid = false;
}
if (isValid && !acctHomeAccountId.contains(acctLocalAccountId)) {
result.add(cacheRecord);
}
}
Expand Down