From a01e68a148fbd012fb450784586d131515d0f3f0 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Fri, 19 Jan 2001 21:45:38 +0000 Subject: [PATCH] fix a server crash on attempting to checksum a model that isn't there --- source/sv_init.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source/sv_init.c b/source/sv_init.c index 517d7c1..c9feb0f 100644 --- a/source/sv_init.c +++ b/source/sv_init.c @@ -280,14 +280,16 @@ SV_CheckModel (char *mdl) { byte stackbuf[1024]; // avoid dirtying the cache heap byte *buf; - unsigned short crc; + unsigned short crc = 0; // int len; buf = (byte *) COM_LoadStackFile (mdl, stackbuf, sizeof (stackbuf)); - crc = CRC_Block (buf, com_filesize); -// for (len = com_filesize; len; len--, buf++) -// CRC_ProcessByte(&crc, *buf); + if (buf) { + crc = CRC_Block (buf, com_filesize); + } else { + Con_Printf ("WARNING: cannot generate checksum for %s\n", mdl); + } return crc; }