Skip to content

Commit

Permalink
add null check (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
raisinrand authored Oct 19, 2024
1 parent 9875952 commit 0e3bc36
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nbnet.h
Original file line number Diff line number Diff line change
Expand Up @@ -1739,7 +1739,7 @@ static bool NBN_ConnectionTable_Remove(NBN_ConnectionTable *table, uint32_t id)
unsigned int slot = hash % table->capacity;
NBN_Connection *conn = table->connections[slot];

if (conn->id == id)
if (conn && conn->id == id)
{
NBN_ConnectionTable_RemoveEntry(table, slot);
return true;
Expand All @@ -1754,7 +1754,7 @@ static bool NBN_ConnectionTable_Remove(NBN_ConnectionTable *table, uint32_t id)
slot = (hash + (int)pow(i, 2)) % table->capacity;
conn = table->connections[slot];

if (conn != NULL && conn->id == id)
if (conn && conn->id == id)
{
NBN_ConnectionTable_RemoveEntry(table, slot);
return true;
Expand Down

0 comments on commit 0e3bc36

Please sign in to comment.