Skip to content

Commit ecc49a4

Browse files
Fix IsSuccess() to handle NullObjectType response correctly
1 parent 397dc02 commit ecc49a4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/app/clusters/testing/ClusterTester.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,14 @@ class ClusterTester
134134
std::optional<ResponseType> response;
135135

136136
// Returns true if the command was successful and response is available
137-
bool IsSuccess() const { return status.has_value() && status->IsSuccess() && response.has_value(); }
137+
bool IsSuccess() const
138+
{
139+
if constexpr (std::is_same_v<ResponseType, app::DataModel::NullObjectType>)
140+
return status.has_value() && status->IsSuccess();
141+
else
142+
return status.has_value() && status->IsSuccess() && response.has_value();
143+
144+
}
138145
};
139146

140147
// Invoke a command and return the decoded result.

0 commit comments

Comments
 (0)