Skip to content

Commit c9b89ea

Browse files
committed
fix : check is component is registered
1 parent b06788a commit c9b89ea

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/main/java/com/github/elebras1/flecs/ComponentRegistry.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,13 @@ protected <T> long register(Class<T> componentClass) {
6161
}
6262

6363
protected <T> long getComponentId(Class<T> componentClass) {
64-
return this.componentIds.get(componentClass);
64+
long id = this.componentIds.get(componentClass);
65+
66+
if (id == -1) {
67+
throw new IllegalArgumentException("Component not registered: " + componentClass.getName());
68+
}
69+
70+
return id;
6571
}
6672

6773
protected <T> Component<T> getComponent(Class<T> componentClass) {

0 commit comments

Comments
 (0)