mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-03-13 22:42:07 +00:00
Fix TArray allocating 0 bytes in constructor
This commit is contained in:
parent
89fb5d0a92
commit
9514d1b120
1 changed files with 3 additions and 3 deletions
|
@ -222,9 +222,9 @@ public:
|
|||
explicit TArray (size_t max, bool reserve = false)
|
||||
{
|
||||
Most = (unsigned)max;
|
||||
Count = (unsigned)(reserve? max : 0);
|
||||
Array = (T *)M_Malloc (sizeof(T)*max);
|
||||
if (reserve && Count > 0)
|
||||
Count = (unsigned)(reserve ? max : 0);
|
||||
Array = max > 0 ? (T *)M_Malloc (sizeof(T)*max) : nullptr;
|
||||
if (Count > 0)
|
||||
{
|
||||
ConstructEmpty(0, Count - 1);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue