mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-14 03:58:18 +00:00
Don't crash with debug mode in demo
Since character doesn't exist then. Reported by murpi Originally introduced in https://github.com/ddnet/ddnet/pull/2578
This commit is contained in:
parent
11d5e87047
commit
7aa6be9e12
|
@ -54,7 +54,11 @@ void CDebugHud::RenderNetCorrections()
|
||||||
w = TextRender()->TextWidth(0, Fontsize, aBuf, -1, -1.0f);
|
w = TextRender()->TextWidth(0, Fontsize, aBuf, -1, -1.0f);
|
||||||
TextRender()->Text(0, x - w, y, Fontsize, aBuf, -1.0f);
|
TextRender()->Text(0, x - w, y, Fontsize, aBuf, -1.0f);
|
||||||
y += LineHeight;
|
y += LineHeight;
|
||||||
str_format(aBuf, sizeof(aBuf), "%d", m_pClient->m_GameWorld.GetCharacterByID(m_pClient->m_Snap.m_LocalClientID)->m_TeleCheckpoint);
|
const CCharacter *pCharacter = m_pClient->m_GameWorld.GetCharacterByID(m_pClient->m_Snap.m_LocalClientID);
|
||||||
|
if(pCharacter)
|
||||||
|
str_format(aBuf, sizeof(aBuf), "%d", pCharacter->m_TeleCheckpoint);
|
||||||
|
else
|
||||||
|
str_copy(aBuf, "-1", sizeof(aBuf));
|
||||||
w = TextRender()->TextWidth(0, Fontsize, aBuf, -1, -1.0f);
|
w = TextRender()->TextWidth(0, Fontsize, aBuf, -1, -1.0f);
|
||||||
TextRender()->Text(0, x - w, y, Fontsize, aBuf, -1.0f);
|
TextRender()->Text(0, x - w, y, Fontsize, aBuf, -1.0f);
|
||||||
y += 2 * LineHeight;
|
y += 2 * LineHeight;
|
||||||
|
|
Loading…
Reference in a new issue