Add null-safety check after deref_to_depth in helper_utils

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Pragyansh Chaturvedi
2026-05-31 15:31:53 +05:30
parent 0482aa2be9
commit 7cdb9cb2f5

View File

@ -111,6 +111,8 @@ def get_or_create_ptr_from_arg(
_, expected_depth = get_base_type_and_depth(expected_type)
if val_depth > expected_depth:
val = deref_to_depth(func, builder, val, val_depth - expected_depth)
if val is None:
raise ValueError("Failed to dereference pointer to expected depth")
ptr, temp_name = compilation_context.scratch_pool.get_next_temp(
local_sym_tab, expected_type