Bug fix in \ncc\Objects > Vault > deleteEntry()

https://git.n64.cc/nosial/ncc/-/issues/27
This commit is contained in:
Netkas 2022-12-07 19:47:44 -05:00
parent 9716ad8e61
commit 33e373c798

View file

@ -74,15 +74,18 @@
*/
public function deleteEntry(string $name): bool
{
foreach($this->Entries as $entry)
// Find the entry
foreach($this->Entries as $index => $entry)
{
if($entry->getName() === $name)
{
$this->Entries = array_diff($this->Entries, [$entry]);
// Remove the entry
unset($this->Entries[$index]);
return true;
}
}
// Entry not found
return false;
}