Check msg_queue size_tail_bytes existence of buffer

This commit is contained in:
Ismael Gomez 2018-05-10 11:02:41 -05:00
parent 62ae4e3094
commit 04609cd07d
1 changed files with 4 additions and 1 deletions

View File

@ -131,7 +131,10 @@ public:
uint32_t size_tail_bytes()
{
pthread_mutex_lock(&mutex);
uint32_t r = buf[tail]->N_bytes;
uint32_t r = 0;
if (buf[tail]) {
r = buf[tail]->N_bytes;
}
pthread_mutex_unlock(&mutex);
return r;
}