From c3a3972378b5870aa458641268b1b62920b786bf Mon Sep 17 00:00:00 2001 From: Michele Guerini Rocco Date: Fri, 21 Mar 2025 08:30:20 +0100 Subject: [PATCH] src/gray_errors.f90: fix possible null prt dereference --- src/gray_errors.f90 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gray_errors.f90 b/src/gray_errors.f90 index 8c1f2a8..0aa795b 100644 --- a/src/gray_errors.f90 +++ b/src/gray_errors.f90 @@ -142,8 +142,11 @@ contains integer, intent(in), optional :: subcase integer(kind=gray_error) :: raise_error - raise_error = ibset(error, spec%offset & - + merge(subcase, 0, present(subcase))) + if (present(subcase)) then + raise_error = ibset(error, spec%offset + subcase) + else + raise_error = ibset(error, spec%offset) + end if end function raise_error