Panic when Context.lookup returns 0

main
copygirl 9 months ago
parent 2cf56693e2
commit 2b7c8528d3
  1. 4
      src/context.zig

@ -15,7 +15,9 @@ pub fn Context(comptime ctx: anytype) type {
/// type that has been registered previously, typically done by /// type that has been registered previously, typically done by
/// calling functions such as `World.component(...)`. /// calling functions such as `World.component(...)`.
pub fn lookup(comptime T: type) c.ecs_entity_t { pub fn lookup(comptime T: type) c.ecs_entity_t {
return lookupMut(T).*; const result = lookupMut(T).*;
if (result == 0) std.debug.panic("No lookup for {s}", .{@typeName(T)});
return result;
} }
/// Returns a pointer unique to this `Context` and the provided type /// Returns a pointer unique to this `Context` and the provided type

Loading…
Cancel
Save