mirror of
https://github.com/libretro/RetroArch.git
synced 2025-01-21 00:05:30 +00:00
fix some potential crashes when a shader is not set in config
This commit is contained in:
parent
37454f79a8
commit
e9b7c7267e
@ -380,9 +380,16 @@ static bool gl_shader_init(gl_t *gl, const gfx_ctx_driver_t *ctx_driver,
|
||||
video_shader_ctx_init_t init_data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
const char *shader_path = retroarch_get_shader_preset();
|
||||
enum rarch_shader_type type = video_shader_parse_type(shader_path,
|
||||
enum rarch_shader_type type;
|
||||
|
||||
if (shader_path)
|
||||
{
|
||||
type = video_shader_parse_type(shader_path,
|
||||
gl->core_context_in_use
|
||||
? RARCH_SHADER_GLSL : DEFAULT_SHADER_TYPE);
|
||||
}
|
||||
else
|
||||
type = DEFAULT_SHADER_TYPE;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
|
@ -138,7 +138,7 @@ bool menu_shader_manager_init(void)
|
||||
menu_driver_shader = (struct video_shader*)
|
||||
calloc(1, sizeof(struct video_shader));
|
||||
|
||||
if (!menu_driver_shader)
|
||||
if (!menu_driver_shader || !path_shader)
|
||||
return false;
|
||||
|
||||
/* In a multi-config setting, we can't have
|
||||
|
@ -1945,14 +1945,14 @@ char* retroarch_get_shader_preset(void)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
if (!settings->bools.video_shader_enable)
|
||||
return "";
|
||||
return NULL;
|
||||
|
||||
if (!string_is_empty(runtime_shader_preset))
|
||||
return runtime_shader_preset;
|
||||
else if (!string_is_empty(settings->paths.path_shader))
|
||||
return settings->paths.path_shader;
|
||||
else
|
||||
return "";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool retroarch_override_setting_is_set(enum rarch_override_setting enum_idx, void *data)
|
||||
|
Loading…
x
Reference in New Issue
Block a user