diff --git a/src/gl/models/gl_models.cpp b/src/gl/models/gl_models.cpp index 3c2eb05c8..0b7870833 100644 --- a/src/gl/models/gl_models.cpp +++ b/src/gl/models/gl_models.cpp @@ -708,7 +708,7 @@ void gl_InitModels() sc.ScriptError("Too many models in %s", smf.type->TypeName.GetChars()); } - if (surface<0 || index >= MD3_MAX_SURFACES) + if (surface<0 || surface >= MD3_MAX_SURFACES) { sc.ScriptError("Invalid MD3 Surface %d in %s", MD3_MAX_SURFACES, smf.type->TypeName.GetChars()); }