diff --git a/src/mmg2d/analys_2d.c b/src/mmg2d/analys_2d.c index 5c3b9ed16..9a0442864 100644 --- a/src/mmg2d/analys_2d.c +++ b/src/mmg2d/analys_2d.c @@ -54,6 +54,10 @@ int MMG2D_setadj(MMG5_pMesh mesh, int8_t init_cc) { int16_t tag; int8_t i,ii,i1,i2; + if ( !mesh->nt ) { + return 1; + } + if ( abs(mesh->info.imprim) > 5 || mesh->info.ddebug ) fprintf(stdout," ** SETTING TOPOLOGY\n"); diff --git a/src/mmg2d/hash_2d.c b/src/mmg2d/hash_2d.c index c3b375b59..77d0feb67 100644 --- a/src/mmg2d/hash_2d.c +++ b/src/mmg2d/hash_2d.c @@ -29,7 +29,7 @@ * \param mesh pointer toward the mesh * \return 1 if success, 0 if fail * - * Create adjacency relations between the triangles dein the mesh + * Create adjacency relations between the triangles in the mesh * */ int MMG2D_hashTria(MMG5_pMesh mesh) { @@ -40,7 +40,7 @@ int MMG2D_hashTria(MMG5_pMesh mesh) { unsigned int key; if ( mesh->adja ) return 1; - if ( !mesh->nt ) return 0; + if ( !mesh->nt ) return 1; /* memory alloc */ MMG5_SAFE_CALLOC(hcode,mesh->nt+1,MMG5_int,return 0); diff --git a/src/mmg2d/length_2d.c b/src/mmg2d/length_2d.c index e3e891098..3f6168baa 100644 --- a/src/mmg2d/length_2d.c +++ b/src/mmg2d/length_2d.c @@ -140,6 +140,10 @@ int MMG2D_prilen(MMG5_pMesh mesh,MMG5_pSol sol) { ibmax = 0; nullEdge = 0; + if ( !mesh->nt ) { + return 0; + } + for (k=0; k<9; k++) hl[k] = 0; for (k=1; k<=mesh->nt; k++) { diff --git a/src/mmg2d/quality_2d.c b/src/mmg2d/quality_2d.c index c252b6c39..b5c493731 100644 --- a/src/mmg2d/quality_2d.c +++ b/src/mmg2d/quality_2d.c @@ -187,6 +187,10 @@ int MMG2D_outqua(MMG5_pMesh mesh,MMG5_pSol met) { MMG5_int k,iel,ok,nex; static int8_t mmgWarn0; + if ( !mesh->nt ) { + return 1; + } + /* Compute triangle quality*/ for (k=1; k<=mesh->nt; k++) { pt = &mesh->tria[k];