diff --git a/libsrc/meshing/meshclass.cpp b/libsrc/meshing/meshclass.cpp index 81d7ead7..356192fc 100644 --- a/libsrc/meshing/meshclass.cpp +++ b/libsrc/meshing/meshclass.cpp @@ -5758,8 +5758,8 @@ namespace netgen { int olds = materials.Size(); materials.SetSize (domnr); - for (int i = olds; i < domnr; i++) - materials[i] = 0; + for (int i = olds; i < domnr-1; i++) + materials[i] = new string("default"); } /* materials.Elem(domnr) = new char[strlen(mat)+1]; @@ -5772,7 +5772,7 @@ namespace netgen { if (domnr <= materials.Size()) return *materials.Get(domnr); - static string emptystring; + static string emptystring("default"); return emptystring; } diff --git a/libsrc/meshing/meshclass.hpp b/libsrc/meshing/meshclass.hpp index 6ec7627a..40d8ebb4 100644 --- a/libsrc/meshing/meshclass.hpp +++ b/libsrc/meshing/meshclass.hpp @@ -594,7 +594,10 @@ namespace netgen /// const string & GetMaterial (int domnr) const; const string * GetMaterialPtr (int domnr) const // 1-based - { return domnr <= materials.Size() ? materials.Get(domnr) : nullptr; } + { + static string defaultmat = "default"; + return domnr <= materials.Size() ? materials.Get(domnr) : &defaultmat; + } DLL_HEADER void SetNBCNames ( int nbcn );