From 79d508b05ab1cf9a770a1e3cb49f1045d49cda03 Mon Sep 17 00:00:00 2001 From: Themaister Date: Mon, 28 May 2012 14:05:03 +0200 Subject: [PATCH] Fix crash when only scale_type_x/y were used. --- gfx/shader_cg.c | 46 ++++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/gfx/shader_cg.c b/gfx/shader_cg.c index 17837fee71..73a2a82a03 100644 --- a/gfx/shader_cg.c +++ b/gfx/shader_cg.c @@ -805,30 +805,36 @@ static bool load_shader_params(unsigned i, config_file_t *conf) scale->abs_x = geom->base_width; scale->abs_y = geom->base_height; - if (strcmp(scale_type_x, "source") == 0) - scale->type_x = RARCH_SCALE_INPUT; - else if (strcmp(scale_type_x, "viewport") == 0) - scale->type_x = RARCH_SCALE_VIEWPORT; - else if (strcmp(scale_type_x, "absolute") == 0) - scale->type_x = RARCH_SCALE_ABSOLUTE; - else + if (scale_type_x) { - RARCH_ERR("Invalid attribute.\n"); - ret = false; - goto end; + if (strcmp(scale_type_x, "source") == 0) + scale->type_x = RARCH_SCALE_INPUT; + else if (strcmp(scale_type_x, "viewport") == 0) + scale->type_x = RARCH_SCALE_VIEWPORT; + else if (strcmp(scale_type_x, "absolute") == 0) + scale->type_x = RARCH_SCALE_ABSOLUTE; + else + { + RARCH_ERR("Invalid attribute.\n"); + ret = false; + goto end; + } } - if (strcmp(scale_type_y, "source") == 0) - scale->type_y = RARCH_SCALE_INPUT; - else if (strcmp(scale_type_y, "viewport") == 0) - scale->type_y = RARCH_SCALE_VIEWPORT; - else if (strcmp(scale_type_y, "absolute") == 0) - scale->type_y = RARCH_SCALE_ABSOLUTE; - else + if (scale_type_y) { - RARCH_ERR("Invalid attribute.\n"); - ret = false; - goto end; + if (strcmp(scale_type_y, "source") == 0) + scale->type_y = RARCH_SCALE_INPUT; + else if (strcmp(scale_type_y, "viewport") == 0) + scale->type_y = RARCH_SCALE_VIEWPORT; + else if (strcmp(scale_type_y, "absolute") == 0) + scale->type_y = RARCH_SCALE_ABSOLUTE; + else + { + RARCH_ERR("Invalid attribute.\n"); + ret = false; + goto end; + } } if (scale->type_x == RARCH_SCALE_ABSOLUTE)