Skip to content

Commit

Permalink
Revert "Eliminate an always-true pointer check"
Browse files Browse the repository at this point in the history
This reverts commit d3fa74f.
  • Loading branch information
inlife committed Jul 30, 2022
1 parent 0c3992b commit ddb3d40
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions include/enet.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#ifndef ENET_INCLUDE_H
#define ENET_INCLUDE_H

#include <assert.h>
#include <stdlib.h>
#include <stdbool.h>
#include <stdint.h>
Expand Down Expand Up @@ -4337,9 +4336,10 @@ extern "C" {
memset(incomingCommand->fragments, 0, (fragmentCount + 31) / 32 * sizeof(enet_uint32));
}

assert(packet != NULL);
++packet->referenceCount;
peer->totalWaitingData += packet->dataLength;
if (packet != NULL) {
++packet->referenceCount;
peer->totalWaitingData += packet->dataLength;
}

enet_list_insert(enet_list_next(currentCommand), incomingCommand);

Expand All @@ -4361,8 +4361,7 @@ extern "C" {
goto notifyError;
}

assert(packet != NULL);
if (packet->referenceCount == 0) {
if (packet != NULL && packet->referenceCount == 0) {
callbacks.packet_destroy(packet);
}

Expand Down

0 comments on commit ddb3d40

Please sign in to comment.