Skip to content

Commit

Permalink
Revert some dumb stuff I tried
Browse files Browse the repository at this point in the history
  • Loading branch information
Kristo Isberg committed Aug 31, 2019
1 parent 7034499 commit 559fb01
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/natives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,15 @@ namespace Natives
{
CHECK_PARAMS(1);

Container::LockExclusive();

const auto id = static_cast<int>(params[1]);
const auto node = Container::Nodes::Find(id);

if (node == nullptr)
{
Container::UnlockExclusive();
return GPS_ERROR_INVALID_NODE;
}

Container::LockExclusive();
Container::Nodes::SetForDeletion(node);
Container::UnlockExclusive();

Expand All @@ -66,9 +64,8 @@ namespace Natives
CHECK_PARAMS(1);

const auto id = static_cast<int>(params[1]);
const auto result = Container::Nodes::Find(id) != nullptr;

return result;
return Container::Nodes::Find(id) != nullptr;
}


Expand Down Expand Up @@ -128,17 +125,15 @@ namespace Natives
{
CHECK_PARAMS(1);

Container::LockExclusive();

const auto id = static_cast<int>(params[1]);
const auto connection = Container::Connections::Find(id);

if (connection == nullptr)
{
Container::UnlockExclusive();
return GPS_ERROR_INVALID_CONNECTION;
}

Container::LockExclusive();
Container::Connections::Delete(connection);
Container::UnlockExclusive();

Expand Down

0 comments on commit 559fb01

Please sign in to comment.