diff --git a/Src/Base/Parser/AMReX_IParser_Exe.H b/Src/Base/Parser/AMReX_IParser_Exe.H index e4854e4cec4..67756a93599 100644 --- a/Src/Base/Parser/AMReX_IParser_Exe.H +++ b/Src/Base/Parser/AMReX_IParser_Exe.H @@ -5,6 +5,8 @@ #include #include +#include + #ifndef AMREX_IPARSER_STACK_SIZE #define AMREX_IPARSER_STACK_SIZE 16 #endif @@ -239,6 +241,8 @@ struct IParserStack AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int iparser_exe_eval (const char* p, int const* x) { + if (p == nullptr) { return std::numeric_limits::max(); } + IParserStack pstack; while (*((iparser_exe_t*)p) != IPARSER_EXE_NULL) { switch (*((iparser_exe_t*)p)) diff --git a/Src/Base/Parser/AMReX_Parser_Exe.H b/Src/Base/Parser/AMReX_Parser_Exe.H index a3d55d04083..37a0b89da78 100644 --- a/Src/Base/Parser/AMReX_Parser_Exe.H +++ b/Src/Base/Parser/AMReX_Parser_Exe.H @@ -5,6 +5,8 @@ #include #include +#include + #ifndef AMREX_PARSER_STACK_SIZE #define AMREX_PARSER_STACK_SIZE 16 #endif @@ -230,6 +232,8 @@ struct ParserStack AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE double parser_exe_eval (const char* p, double const* x) { + if (p == nullptr) { return std::numeric_limits::max(); } + ParserStack pstack; while (*((parser_exe_t*)p) != PARSER_EXE_NULL) { // NOLINT switch (*((parser_exe_t*)p))