Skip to content

Commit

Permalink
Merge pull request #23 from PipeRift/hotfix/general-fixes
Browse files Browse the repository at this point in the history
Fixed crash on pool copy
  • Loading branch information
muit authored Feb 25, 2023
2 parents 4c99b71 + 81e184d commit ccf8a9b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions Include/Pipe/Core/Optional.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,15 @@ namespace p
"use Get(defaultValue) instead.");
return value;
}
/** @return The optional value; undefined when IsSet() returns false. */
const Type* TryGet() const
{
return IsSet() ? &value : nullptr;
}
Type* TryGet()
{
return IsSet() ? &value : nullptr;
}

const Type& operator*() const
{
Expand Down
2 changes: 1 addition & 1 deletion Src/ECS/BasePool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace p::ecs
for (i32 i = 0; i < other.Size(); ++i)
{
const Id id = other.idList[i];
if (id != ecs::NoId)
if (ecs::GetVersion(id) != ecs::NoVersion)
{
EmplaceId(id, true);
}
Expand Down

0 comments on commit ccf8a9b

Please sign in to comment.