mirror of
https://github.com/bdnugget/nbnet.git
synced 2026-11-07 05:27:27 +00:00
add null check (#74)
This commit is contained in:
1 parent
987595211f
commit
0e3bc3655c
1 file changed
+2
-2
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user