Skip to content

Commit 00e4fd7

Browse files
authored
fix(MemoryHelper.f90): add optional checks (#2141)
Fixes crash that occurred when compiled with flang-new 19.1.1 on windows
1 parent 0756f90 commit 00e4fd7

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/Utilities/Memory/MemoryHelper.f90

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,14 @@ function create_mem_path(component, subcomponent, context) result(memory_path)
2525
character(len=LENMEMPATH) :: memory_path !< the memory path
2626

2727
call mem_check_length(component, LENCOMPONENTNAME, "solution/model/exchange")
28-
call mem_check_length(subcomponent, LENCOMPONENTNAME, "package")
29-
call mem_check_length(context, LENCONTEXTNAME, "context")
28+
29+
if (present(subcomponent)) then
30+
call mem_check_length(subcomponent, LENCOMPONENTNAME, "package")
31+
end if
32+
33+
if (present(context)) then
34+
call mem_check_length(context, LENCONTEXTNAME, "context")
35+
end if
3036

3137
memory_path = trim(component)
3238

0 commit comments

Comments
 (0)