Fix use of gwbuf_length in mxs::Buffer
Backend should use empty() instead of length() to see if the buffer is empty. The length of a buffer should always be valid to call, even on empty buffers.
This commit is contained in:
@ -1099,7 +1099,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
size_t length() const
|
size_t length() const
|
||||||
{
|
{
|
||||||
return gwbuf_length(m_pBuffer);
|
return m_pBuffer ? gwbuf_length(m_pBuffer) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -253,7 +253,7 @@ bool Backend::write_stored_command()
|
|||||||
mxb_assert(in_use());
|
mxb_assert(in_use());
|
||||||
bool rval = false;
|
bool rval = false;
|
||||||
|
|
||||||
if (m_pending_cmd.length())
|
if (!m_pending_cmd.empty())
|
||||||
{
|
{
|
||||||
rval = write(m_pending_cmd.release());
|
rval = write(m_pending_cmd.release());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user