diff --git a/src/value.zig b/src/value.zig index ec0f359671..3efb107322 100644 --- a/src/value.zig +++ b/src/value.zig @@ -483,10 +483,10 @@ pub const Value = struct { } pub fn getFunction(val: Value, mod: *Module) ?InternPool.Key.Func { - return switch (mod.intern_pool.indexToKey(val.toIntern())) { + return if (val.ip_index != .none) switch (mod.intern_pool.indexToKey(val.toIntern())) { .func => |x| x, else => null, - }; + } else null; } pub fn getExternFunc(val: Value, mod: *Module) ?InternPool.Key.ExternFunc {