fix crash on trying to free a NULL communicator

This commit is contained in:
Axel Kohlmeyer
2025-07-08 16:17:48 -04:00
parent 2b8b84788b
commit 7ac03b6c9e
2 changed files with 4 additions and 2 deletions

View File

@ -220,5 +220,6 @@ void AngleWrite::command(int narg, char **arg)
// clean up
delete writer;
}
MPI_Comm_free(&singlecomm);
if (singlecomm != MPI_COMM_NULL)
MPI_Comm_free(&singlecomm);
}

View File

@ -198,5 +198,6 @@ void DihedralWrite::command(int narg, char **arg)
delete writer;
fclose(fp);
}
MPI_Comm_free(&singlecomm);
if (singlecomm != MPI_COMM_NULL)
MPI_Comm_free(&singlecomm);
}