mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 05:35:49 -04:00
Adding null pointer checks in bank.cpp
This commit is contained in:
parent
fd24191d31
commit
9ff0deda75
1 changed files with 11 additions and 1 deletions
12
src/bank.cpp
12
src/bank.cpp
|
|
@ -72,7 +72,7 @@ void sort_fission_bank()
|
|||
|
||||
// TODO: C++17 introduces the exclusive_scan() function which could be
|
||||
// used to replace everything above this point in this function.
|
||||
|
||||
|
||||
// We need a scratch vector to make permutation of the fission bank into
|
||||
// sorted order easy. Under normal usage conditions, the fission bank is
|
||||
// over provisioned, so we can use that as scratch space.
|
||||
|
|
@ -106,6 +106,11 @@ void sort_fission_bank()
|
|||
|
||||
extern "C" int openmc_source_bank(void** ptr, int64_t* n)
|
||||
{
|
||||
if (!ptr || !n) {
|
||||
set_errmsg("Received null pointer.");
|
||||
return OPENMC_E_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
if (simulation::source_bank.size() == 0) {
|
||||
set_errmsg("Source bank has not been allocated.");
|
||||
return OPENMC_E_ALLOCATE;
|
||||
|
|
@ -118,6 +123,11 @@ extern "C" int openmc_source_bank(void** ptr, int64_t* n)
|
|||
|
||||
extern "C" int openmc_fission_bank(void** ptr, int64_t* n)
|
||||
{
|
||||
if (!ptr || !n) {
|
||||
set_errmsg("Received null pointer.");
|
||||
return OPENMC_E_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
if (simulation::fission_bank.size() == 0) {
|
||||
set_errmsg("Fission bank has not been allocated.");
|
||||
return OPENMC_E_ALLOCATE;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue