5222: Fix crash because of hooks on non ddnet server r=def- a=C0D3D3V

Reported by `@Ясно` Понятно 
on non ddnet server, this code gets run to detect strong-weak ids:
6a5673aa04/src/game/client/gameclient.cpp (L2540-L2541)
which causes a crash because this CCharacterCore is not bound to a gameworld 
the check for m_pWorld failed because m_pWorld is fill of random data
ac15943e85/src/game/gamecore.cpp (L625)
So I would also like to initialize it with a nullpointer 

## Checklist

- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [x] Considered possible null pointers and out of bounds array indexing
- [x] Changed no physics that affect existing maps
- [x] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: c0d3d3v <c0d3d3v@mag-keinen-spam.de>
This commit is contained in:
bors[bot] 2022-05-25 15:51:43 +00:00 committed by GitHub
commit 1ca4220adf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -550,7 +550,7 @@ void CCharacterCore::ReadCharacterCore(const CNetObj_CharacterCore *pObjCore)
m_HookPos.y = pObjCore->m_HookY;
m_HookDir.x = pObjCore->m_HookDx / 256.0f;
m_HookDir.y = pObjCore->m_HookDy / 256.0f;
SetHookedPlayer(pObjCore->m_HookedPlayer);
m_HookedPlayer = pObjCore->m_HookedPlayer;
m_Jumped = pObjCore->m_Jumped;
m_Direction = pObjCore->m_Direction;
m_Angle = pObjCore->m_Angle;

View file

@ -206,7 +206,7 @@ public:
class CCharacterCore
{
friend class CCharacter;
CWorldCore *m_pWorld;
CWorldCore *m_pWorld = nullptr;
CCollision *m_pCollision;
std::map<int, std::vector<vec2>> *m_pTeleOuts;