Skip to content

Commit

Permalink
add some conditionals to prevent segfault
Browse files Browse the repository at this point in the history
  • Loading branch information
kulakovri committed Feb 13, 2024
1 parent cc60f31 commit 435ba89
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions MDLIB/Setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,9 @@ void SetBCs(SetBCs_ff setBCs, MdoodzInput *instance, grid *mesh, markers *topo_c
double VxWestSum = 0.0;
double VxEastSum = 0.0;

if (instance->topo_height) {
if (instance->topo_height && topo_chain->Nb_part && topo_chain->z[0] && topo_chain->z[topo_chain->Nb_part - 1]) {
instance->topo_height->west = topo_chain->z[0];
instance->topo_height->east = topo_chain->z[topo_chain->Nb_part-1];
instance->topo_height->east = topo_chain->z[topo_chain->Nb_part - 1];
}

for (int l = 0; l < mesh->Nz + 1; l++) {
Expand Down

0 comments on commit 435ba89

Please sign in to comment.