mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-07-27 07:31:49 +03:00
Check type of SQVector construction instance
This prevents manual invocations of the Vector.constructor with an invalid value.
This commit is contained in:
parent
681a75a6a7
commit
655679e7da
@ -327,7 +327,16 @@ namespace SQVector
|
||||
}
|
||||
|
||||
SQUserPointer p;
|
||||
sq_getinstanceup(vm, 1, &p, 0);
|
||||
if (SQ_FAILED(sq_getinstanceup(vm, 1, &p, 0)))
|
||||
{
|
||||
return SQ_ERROR;
|
||||
}
|
||||
|
||||
if (!p)
|
||||
{
|
||||
return sq_throwerror(vm, "Accessed null instance");
|
||||
}
|
||||
|
||||
new (p) Vector(x, y, z);
|
||||
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user