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:
parent
0c19d1ea03
commit
b04415d8da
@ -1099,7 +1099,7 @@ public:
|
||||
*/
|
||||
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());
|
||||
bool rval = false;
|
||||
|
||||
if (m_pending_cmd.length())
|
||||
if (!m_pending_cmd.empty())
|
||||
{
|
||||
rval = write(m_pending_cmd.release());
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user