diff --git a/libsrc/general/table.cpp b/libsrc/general/table.cpp index 732d63c3..e39d671b 100644 --- a/libsrc/general/table.cpp +++ b/libsrc/general/table.cpp @@ -108,14 +108,16 @@ namespace netgen if (line.size == line.maxsize) { void * p = new char [(line.maxsize+5) * elsize]; - - memcpy (p, line.col, line.maxsize * elsize); - delete [] (char*)line.col; + + if (line.size > 0 && line.col != NULL) { + memcpy (p, line.col, line.maxsize * elsize); + delete [] (char*)line.col; + } line.col = p; line.maxsize += 5; } - + line.size++; } diff --git a/libsrc/general/table.hpp b/libsrc/general/table.hpp index 535d0212..44c5f9fb 100644 --- a/libsrc/general/table.hpp +++ b/libsrc/general/table.hpp @@ -120,7 +120,8 @@ public: /// Creates fixed maximal element size table inline TABLE (const NgFlatArray & entrysizes) - : BASE_TABLE (NgFlatArray (entrysizes.Size(), const_cast(&entrysizes[BASE])), + : BASE_TABLE (NgFlatArray (entrysizes.Size(), + entrysizes.Size() > 0 ? const_cast(&entrysizes[BASE]) : 0), sizeof(T)) { ; }