add null check (#74)

This commit is contained in:
Bryan Tabor authored and GitHub committed 2024-10-19 14:11:02 +02:00
1 parent 987595211f
commit 0e3bc3655c
1 file changed
+2 -2
+2 -2
View File
@@ -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;
@@ -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;