Skip to content

Commit

Permalink
Fix panic on deserializing entities without components
Browse files Browse the repository at this point in the history
  • Loading branch information
mlange-42 committed Feb 24, 2024
1 parent eae967b commit 2eb7968
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## [[unpublished]](https://github.com/mlange-42/arche/compare/v0.1.0...main)

* Fix panic on deserializing entities without components (#12)

## [[v0.1.0]](https://github.com/mlange-42/arche-serde/commits/v0.1.0/)

* Initial release of [arche-serde](https://github.com/mlange-42/arche-serde)
5 changes: 5 additions & 0 deletions deserialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ func deserializeComponents(world *ecs.World, deserial *deserializer) error {
Comp: component,
})
}

if len(components) == 0 {
continue
}

builder := ecs.NewBuilderWith(world, components...)
if target.IsZero() {
builder.Add(entity)
Expand Down

0 comments on commit 2eb7968

Please sign in to comment.