1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-02-20 19:57:12 +01:00

Add a small check to prevent forwarding event if we failed to create the buffer instance.

This commit is contained in:
Sandu Liviu Catalin 2016-06-20 14:30:48 +03:00
parent 5f983cdacf
commit c2ac1f3fd8

View File

@ -1066,7 +1066,12 @@ void Core::EmitClientScriptData(Int32 player_id, const uint8_t * data, size_t si
// Replicate the data to the allocated buffer
b.Write(0, reinterpret_cast< Buffer::ConstPtr >(data), size);
// Wrap the buffer into a script object
Object o = MakeObject(m_VM, BufferWrapper(std::move(b)));
const Object o = MakeObject(m_VM, BufferWrapper(std::move(b)));
// Wrap the buffer into a script object
if (o.IsNull())
{
STHROWF("Unable to transform script data into buffer");
}
// Forward the event call
PlayerInst & _player = m_Players.at(player_id);
Emit(_player.mOnClientScriptData, o, size);