Correct deletion of non-allocated memory in ngarray

A default-constructed (or just empty) ngarray will have 'ownmem' set
despite not having an allocated data array.  Destructor would then
trigger an abort.
This commit is contained in:
Monty Montgomery 2022-05-15 00:36:17 -04:00
parent 5ee4e43393
commit 6ba4a6e6c6

View File

@ -295,6 +295,7 @@ namespace netgen
/// if responsible, deletes memory
~NgArray()
{
if (data)
if (ownmem)
delete [] data;
}
@ -374,6 +375,7 @@ namespace netgen
/// Deallocate memory
void DeleteAll ()
{
if (data)
if (ownmem)
delete [] data;
data = 0;