diff --git a/Quake/pr_cmds.c b/Quake/pr_cmds.c index ba787a7a..340243bb 100644 --- a/Quake/pr_cmds.c +++ b/Quake/pr_cmds.c @@ -661,6 +661,12 @@ static void PF_sound (void) volume = G_FLOAT(OFS_PARM3) * 255; attenuation = G_FLOAT(OFS_PARM4); + if (!*sample) + { + PR_RunWarning("PF_sound: empty string\n"); + return; + } + /* Spike -- these checks are redundant if (volume < 0 || volume > 255) Host_Error ("SV_StartSound: volume = %i", volume); diff --git a/Quake/pr_exec.c b/Quake/pr_exec.c index c96526ab..16096d51 100644 --- a/Quake/pr_exec.c +++ b/Quake/pr_exec.c @@ -258,6 +258,21 @@ void PR_RunError (const char *error, ...) Host_Error("Program error"); } +void PR_RunWarning (const char *error, ...) +{ + va_list argptr; + char string[1024]; + + va_start (argptr, error); + q_vsnprintf (string, sizeof(string), error, argptr); + va_end (argptr); + + PR_PrintStatement(qcvm->statements + qcvm->xstatement); + PR_StackTrace(); + + Con_Warning("%s\n", string); +} + /* ==================== PR_EnterFunction diff --git a/Quake/progs.h b/Quake/progs.h index 9315abd9..c5699957 100644 --- a/Quake/progs.h +++ b/Quake/progs.h @@ -139,6 +139,7 @@ int NUM_FOR_EDICT(edict_t *e); extern int type_size[8]; FUNC_NORETURN void PR_RunError (const char *error, ...) FUNC_PRINTF(1,2); +void PR_RunWarning (const char *error, ...) FUNC_PRINTF(1,2); #ifdef __WATCOMC__ #pragma aux PR_RunError aborts; #endif