diff --git a/src/controller/CHIPDevice.cpp b/src/controller/CHIPDevice.cpp index 6eee9658bfe7b6..4e83761ed49dd6 100644 --- a/src/controller/CHIPDevice.cpp +++ b/src/controller/CHIPDevice.cpp @@ -268,9 +268,10 @@ CHIP_ERROR Device::LoadSecureSessionParameters(ResetTransport resetNeeded) bool Device::GetIpAddress(Inet::IPAddress & addr) const { - if (mState != ConnectionState::NotConnected) - addr = mDeviceAddr; - return mState != ConnectionState::NotConnected; + if (mState == ConnectionState::NotConnected) + return false; + addr = mDeviceAddr; + return true; } void Device::AddResponseHandler(EndpointId endpoint, ClusterId cluster, Callback::Callback<> * onResponse)