NULL pointer fix.

This commit is contained in:
Steve 2015-11-28 14:34:19 +00:00
parent 1816bf406c
commit 31eee4a86f
1 changed files with 6 additions and 1 deletions

View File

@ -52,6 +52,11 @@ void doMessageBox(void)
{ {
if (--msg->time <= -FPS) if (--msg->time <= -FPS)
{ {
if (msg == tail)
{
tail = prev;
}
prev->next = msg->next; prev->next = msg->next;
free(msg); free(msg);
msg = prev; msg = prev;
@ -82,7 +87,7 @@ void drawMessageBox(void)
drawText(r.x + 10, r.y + 5, 18, TA_LEFT, colors.cyan, msg->title); drawText(r.x + 10, r.y + 5, 18, TA_LEFT, colors.cyan, msg->title);
limitTextWidth(600); limitTextWidth(550);
drawText(r.x + 10, r.y + 30, 18, TA_LEFT, colors.white, msg->body); drawText(r.x + 10, r.y + 30, 18, TA_LEFT, colors.white, msg->body);