diff --git a/src/core/coap/coap.hpp b/src/core/coap/coap.hpp index 1d40b0dd0..72f1afc8b 100644 --- a/src/core/coap/coap.hpp +++ b/src/core/coap/coap.hpp @@ -304,7 +304,9 @@ public: */ static void RemoveFrom(Message &aMessage) { - assert(aMessage.SetLength(aMessage.GetLength() - sizeof(EnqueuedResponseHeader)) == OT_ERROR_NONE); + otError error = aMessage.SetLength(aMessage.GetLength() - sizeof(EnqueuedResponseHeader)); + assert(error == OT_ERROR_NONE); + OT_UNUSED_VARIABLE(error); } /**