forked from Mirrorlandia_minetest/minetest
Fix undefined behaviour on getting pointer to data in empty vector
`&vector[0]` is undefined if vector.empty(), causing build failure on MSVC
This commit is contained in:
parent
b3167d4e57
commit
bb219e1059
@ -62,7 +62,7 @@ void NetworkPacket::putRawPacket(u8 *data, u32 datasize, u16 peer_id)
|
||||
|
||||
// split command and datas
|
||||
m_command = readU16(&data[0]);
|
||||
memcpy(&m_data[0], &data[2], m_datasize);
|
||||
memcpy(m_data.data(), &data[2], m_datasize);
|
||||
}
|
||||
|
||||
const char* NetworkPacket::getString(u32 from_offset)
|
||||
|
Loading…
Reference in New Issue
Block a user