Avoid an unknown value from attachment rewind
This commit is contained in:
parent
4d75042f3b
commit
366313d29d
@ -269,7 +269,13 @@ void Attachment::saveState(BareNetworkString *buffer) const
|
|||||||
void Attachment::rewindTo(BareNetworkString *buffer)
|
void Attachment::rewindTo(BareNetworkString *buffer)
|
||||||
{
|
{
|
||||||
uint8_t type = buffer->getUInt8();
|
uint8_t type = buffer->getUInt8();
|
||||||
|
|
||||||
AttachmentType new_type = AttachmentType(type & 0x7f); // mask out bit 7
|
AttachmentType new_type = AttachmentType(type & 0x7f); // mask out bit 7
|
||||||
|
// FIXME Sometimes type == 255 is returned, reason unknown
|
||||||
|
if (new_type > ATTACH_NOTHING)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// If there is no attachment, clear the attachment if necessary and exit
|
// If there is no attachment, clear the attachment if necessary and exit
|
||||||
if(new_type==ATTACH_NOTHING)
|
if(new_type==ATTACH_NOTHING)
|
||||||
|
Loading…
Reference in New Issue
Block a user