- // call the apropriate loader
- num = LittleLong(*((int *)buf));
- if (!memcmp(buf, "IDPO", 4)) Mod_IDP0_Load(mod, buf);
- else if (!memcmp(buf, "IDP2", 4)) Mod_IDP2_Load(mod, buf);
- else if (!memcmp(buf, "IDP3", 4)) Mod_IDP3_Load(mod, buf);
- else if (!memcmp(buf, "IDSP", 4)) Mod_IDSP_Load(mod, buf);
- else if (!memcmp(buf, "IBSP", 4)) Mod_IBSP_Load(mod, buf);
- else if (!memcmp(buf, "ZYMOTICMODEL", 12)) Mod_ZYMOTICMODEL_Load(mod, buf);
- else if (strlen(mod->name) >= 4 && !strcmp(mod->name - 4, ".map")) Mod_MAP_Load(mod, buf);
- else if (num == BSPVERSION || num == 30) Mod_Q1BSP_Load(mod, buf);
- else Host_Error("Mod_LoadModel: model \"%s\" is of unknown/unsupported type\n", mod->name);
-
- Mem_Free(buf);
+ if (buf)
+ {
+ num = LittleLong(*((int *)buf));
+ // call the apropriate loader
+ loadmodel = mod;
+ if (!memcmp(buf, "IDPO", 4)) Mod_IDP0_Load(mod, buf);
+ else if (!memcmp(buf, "IDP2", 4)) Mod_IDP2_Load(mod, buf);
+ else if (!memcmp(buf, "IDP3", 4)) Mod_IDP3_Load(mod, buf);
+ else if (!memcmp(buf, "IDSP", 4)) Mod_IDSP_Load(mod, buf);
+ else if (!memcmp(buf, "IBSP", 4)) Mod_IBSP_Load(mod, buf);
+ else if (!memcmp(buf, "ZYMOTICMODEL", 12)) Mod_ZYMOTICMODEL_Load(mod, buf);
+ else if (strlen(mod->name) >= 4 && !strcmp(mod->name - 4, ".map")) Mod_MAP_Load(mod, buf);
+ else if (num == BSPVERSION || num == 30) Mod_Q1BSP_Load(mod, buf);
+ else Host_Error("Mod_LoadModel: model \"%s\" is of unknown/unsupported type\n", mod->name);
+ Mem_Free(buf);
+ }
+ else if (crash)
+ {
+ // LordHavoc: Sys_Error was *ANNOYING*
+ Con_Printf ("Mod_LoadModel: %s not found", mod->name);
+ }