Skip to content

Commit

Permalink
Fix edge case with passing 0 to PawnAddressToPtr
Browse files Browse the repository at this point in the history
  • Loading branch information
KitRifty committed Feb 16, 2024
1 parent 95d0fcd commit e38c5da
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions extension/helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@ inline cell_t PtrToPawnAddress(const void* ptr) {

inline void* PawnAddressToPtr(cell_t addr) {
#ifdef PLATFORM_X64
if (!addr) {
// BUGFIX: Passing 0 to FromPseudoAddress won't return nullptr but a valid pseudo address.
// If we're getting 0 from a plugin then we treat it as nullptr since Address_Null is 0.
return 0;
}
return (void*)g_pSM->FromPseudoAddress(addr);
#else
return (void*)addr;
Expand Down

0 comments on commit e38c5da

Please sign in to comment.