mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-22 18:09:41 +00:00
Do not pass nullptr to std::memcmp
This commit is contained in:
parent
7917f1fc84
commit
dd0b45ede6
1 changed files with 11 additions and 0 deletions
|
@ -179,6 +179,17 @@ namespace DetourNavigator
|
||||||
const auto lhsEnd = reinterpret_cast<const char*>(lhs.data() + lhs.size());
|
const auto lhsEnd = reinterpret_cast<const char*>(lhs.data() + lhs.size());
|
||||||
const auto lhsSize = static_cast<std::ptrdiff_t>(lhsEnd - lhsBegin);
|
const auto lhsSize = static_cast<std::ptrdiff_t>(lhsEnd - lhsBegin);
|
||||||
const auto rhsSize = static_cast<std::ptrdiff_t>(mRhsEnd - mRhsIt);
|
const auto rhsSize = static_cast<std::ptrdiff_t>(mRhsEnd - mRhsIt);
|
||||||
|
|
||||||
|
if (lhsBegin == nullptr || mRhsIt == nullptr)
|
||||||
|
{
|
||||||
|
if (lhsSize < rhsSize)
|
||||||
|
return -1;
|
||||||
|
else if (lhsSize > rhsSize)
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
const auto size = std::min(lhsSize, rhsSize);
|
const auto size = std::min(lhsSize, rhsSize);
|
||||||
|
|
||||||
if (const auto result = std::memcmp(lhsBegin, mRhsIt, size))
|
if (const auto result = std::memcmp(lhsBegin, mRhsIt, size))
|
||||||
|
|
Loading…
Reference in a new issue