From 7589abcfc4c1ce195a5f490c7977c8de21b183c2 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 13 Nov 2023 18:50:15 +0000 Subject: [PATCH] Remove redundant check --- Packet++/header/DhcpLayer.h | 2 +- Packet++/header/IPv4Layer.h | 2 +- Packet++/header/IPv6Extensions.h | 2 +- Packet++/header/TcpLayer.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Packet++/header/DhcpLayer.h b/Packet++/header/DhcpLayer.h index a96e4f86bd..c34b905ff5 100644 --- a/Packet++/header/DhcpLayer.h +++ b/Packet++/header/DhcpLayer.h @@ -502,7 +502,7 @@ namespace pcpp return; } - if (m_Data == nullptr || m_Data->recordType == (uint8_t)DHCPOPT_END || m_Data->recordType == (uint8_t)DHCPOPT_PAD) + if (m_Data->recordType == (uint8_t)DHCPOPT_END || m_Data->recordType == (uint8_t)DHCPOPT_PAD) return; if (tlvDataLen < sizeof(TLVRawData::recordType) + sizeof(TLVRawData::recordLen)) diff --git a/Packet++/header/IPv4Layer.h b/Packet++/header/IPv4Layer.h index 7bb04e73b9..e0d1c74a04 100644 --- a/Packet++/header/IPv4Layer.h +++ b/Packet++/header/IPv4Layer.h @@ -352,7 +352,7 @@ namespace pcpp return; } - if (m_Data == nullptr || getIPv4OptionType() == (uint8_t)IPV4OPT_EndOfOptionsList || m_Data->recordType == (uint8_t)IPV4OPT_NOP) + if (getIPv4OptionType() == (uint8_t)IPV4OPT_EndOfOptionsList || m_Data->recordType == (uint8_t)IPV4OPT_NOP) return; if (tlvDataLen < sizeof(TLVRawData::recordType) + sizeof(TLVRawData::recordLen)) diff --git a/Packet++/header/IPv6Extensions.h b/Packet++/header/IPv6Extensions.h index 8bda061ee7..c40e84da26 100644 --- a/Packet++/header/IPv6Extensions.h +++ b/Packet++/header/IPv6Extensions.h @@ -245,7 +245,7 @@ namespace pcpp return; } - if (m_Data == nullptr || m_Data->recordType == Pad0OptionType) + if (m_Data->recordType == Pad0OptionType) return; if (tlvDataLen < sizeof(TLVRawData::recordType) + sizeof(TLVRawData::recordLen)) diff --git a/Packet++/header/TcpLayer.h b/Packet++/header/TcpLayer.h index db463b3031..ab0c6ee1fe 100644 --- a/Packet++/header/TcpLayer.h +++ b/Packet++/header/TcpLayer.h @@ -255,7 +255,7 @@ namespace pcpp return; } - if (m_Data == nullptr || m_Data->recordType == (uint8_t)PCPP_TCPOPT_NOP || m_Data->recordType == (uint8_t)PCPP_TCPOPT_EOL) + if (m_Data->recordType == (uint8_t)PCPP_TCPOPT_NOP || m_Data->recordType == (uint8_t)PCPP_TCPOPT_EOL) return; if (tlvDataLen < sizeof(TLVRawData::recordType) + sizeof(TLVRawData::recordLen))