mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-26 22:01:50 +00:00
Fixed r_showshaders crashing on a surface without shadername.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5335 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
2d539675cf
commit
4cabdb80c5
1 changed files with 15 additions and 13 deletions
|
@ -7300,21 +7300,23 @@ char *Shader_GetShaderBody(shader_t *s, char *fname, size_t fnamesize)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strchr(parsename, ':'))
|
if ( parsename ) {
|
||||||
{
|
if (!strchr(parsename, ':'))
|
||||||
//if the named shader is a .shader file then just directly load it.
|
|
||||||
const char *token = COM_GetFileExtension(parsename, NULL);
|
|
||||||
if (!strcmp(token, ".shader") || !*token)
|
|
||||||
{
|
{
|
||||||
char shaderfile[MAX_QPATH];
|
//if the named shader is a .shader file then just directly load it.
|
||||||
if (!*token)
|
const char *token = COM_GetFileExtension(parsename, NULL);
|
||||||
|
if (!strcmp(token, ".shader") || !*token)
|
||||||
{
|
{
|
||||||
Q_snprintfz(shaderfile, sizeof(shaderfile), "%s.shader", parsename);
|
char shaderfile[MAX_QPATH];
|
||||||
if (COM_FCheckExists(shaderfile))
|
if (!*token)
|
||||||
Q_snprintfz(fname, fnamesize, "%s:%i", shaderfile, 1);
|
{
|
||||||
|
Q_snprintfz(shaderfile, sizeof(shaderfile), "%s.shader", parsename);
|
||||||
|
if (COM_FCheckExists(shaderfile))
|
||||||
|
Q_snprintfz(fname, fnamesize, "%s:%i", shaderfile, 1);
|
||||||
|
}
|
||||||
|
else if (COM_FCheckExists(parsename))
|
||||||
|
Q_snprintfz(fname, fnamesize, "%s:%i", parsename, 1);
|
||||||
}
|
}
|
||||||
else if (COM_FCheckExists(parsename))
|
|
||||||
Q_snprintfz(fname, fnamesize, "%s:%i", parsename, 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue