Skip to content

Commit

Permalink
Address review commment.
Browse files Browse the repository at this point in the history
  • Loading branch information
bzbarsky-apple committed Feb 6, 2023
1 parent af27aae commit 26e556c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/app/clusters/door-lock-server/door-lock-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ void DoorLockServer::setUserCommandHandler(chip::app::CommandHandler * commandOb
return;
}

if (!userType.IsNull() && userType.Value() == UserTypeEnum::kUnknownEnumValue)
if (userType == UserTypeEnum::kUnknownEnumValue)
{
emberAfDoorLockClusterPrintln(
"[SetUser] Unable to set the user: user type is unknown [endpointId=%d,userIndex=%d,userType=%u]",
Expand Down Expand Up @@ -693,7 +693,7 @@ void DoorLockServer::setCredentialCommandHandler(
return;
}

if (!userType.IsNull() && userType.Value() == UserTypeEnum::kUnknownEnumValue)
if (userType == UserTypeEnum::kUnknownEnumValue)
{
emberAfDoorLockClusterPrintln("[SetCredential] Unable to set the credential: user type is unknown "
"[endpointId=%d,credentialIndex=%d,userType=%u]",
Expand Down
2 changes: 2 additions & 0 deletions src/app/data-model/Nullable.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ struct Nullable : protected Optional<T>

bool operator==(const Nullable & other) const { return Optional<T>::operator==(other); }
bool operator!=(const Nullable & other) const { return !(*this == other); }
bool operator==(const T & other) const { return !IsNull() && Value() == other; }
bool operator!=(const T & other) const { return IsNull() || Value() != other; }
};

template <class T>
Expand Down

0 comments on commit 26e556c

Please sign in to comment.