Prevent immediate crash when compiling with SANITIZER=address

This commit is contained in:
twinaphex 2017-05-28 17:46:01 +02:00
parent 3fbed8df27
commit 857562bf9d

View File

@ -487,19 +487,20 @@ bool video_shader_resolve_parameters(config_file_t *conf,
for (i = 0; i < shader->passes; i++)
{
char line[4096];
RFILE *file = NULL;
const char *path = shader->pass[i].source.path;
#ifdef HAVE_SLANG
/* First try to use the more robust slang implementation to support #includes. */
/* FIXME: The check for slang can be removed if it's sufficiently tested for
* GLSL/Cg as well, it should be the same implementation. */
if ((string_is_equal_fast(path_get_extension(shader->pass[i].source.path), "slang", 5)) &&
if (!string_is_empty(path) && (string_is_equal_fast(path_get_extension(path), "slang", 5)) &&
slang_preprocess_parse_parameters(shader->pass[i].source.path, shader))
continue;
/* If that doesn't work, fallback to the old path.
* Ideally, we'd get rid of this path sooner or later. */
#endif
char line[4096];
RFILE *file = filestream_open(shader->pass[i].source.path, RFILE_MODE_READ_TEXT, -1);
file = filestream_open(shader->pass[i].source.path, RFILE_MODE_READ_TEXT, -1);
if (!file)
continue;