Fix nullptr deref in archive

Hardened toolchains (eg, mainline Fedora) no longer tolerate null
derefs that were silently trapped/ignored in earlier versions.  This
eliminates a nullptr deref in archive.hpp that was failing several
unit tests (and causing crashes) when trying to manipulate
default-constructed archive objects.
This commit is contained in:
Monty Montgomery 2022-05-15 00:33:11 -04:00
parent 97d3c1ce9e
commit 5ee4e43393

View File

@ -225,6 +225,7 @@ namespace ngcore
(*this) & size;
if(Input())
v.resize(size);
if(size > 0) // can't deref v[0] if it doesn't exist
Do(&v[0], size);
return (*this);
}