Fix NULL Crash on ReferenceToIndex (#2311)
Some checks are pending
Continuous Integration / ${{ matrix.os_short }}-${{ matrix.compiler_cc }} (clang, clang++, ubuntu-latest, linux) (push) Waiting to run
Continuous Integration / ${{ matrix.os_short }}-${{ matrix.compiler_cc }} (clang-14, clang++-14, ubuntu-22.04, linux) (push) Waiting to run
Continuous Integration / ${{ matrix.os_short }}-${{ matrix.compiler_cc }} (msvc, windows-latest, win) (push) Waiting to run
hl2sdk-mock tests / mock (push) Waiting to run

This commit is contained in:
caxanga334 2025-04-25 14:52:44 -03:00 committed by GitHub
parent 2a25025d2e
commit f7e51b6110
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1102,7 +1102,7 @@ int CHalfLife2::ReferenceToIndex(cell_t entRef)
CEntInfo *pInfo = LookupEntity(hndl.GetEntryIndex()); CEntInfo *pInfo = LookupEntity(hndl.GetEntryIndex());
if (pInfo->m_SerialNumber != hndl.GetSerialNumber()) if (!pInfo || pInfo->m_SerialNumber != hndl.GetSerialNumber())
{ {
return INVALID_EHANDLE_INDEX; return INVALID_EHANDLE_INDEX;
} }