wined3d: Check the result from wine_rb_get() before using it in WINE_RB_ENTRY_VALUE.

This commit is contained in:
Henri Verbeet 2009-06-05 10:10:46 +02:00 committed by Alexandre Julliard
parent 70cdb5c3e4
commit cae6a32b08
2 changed files with 5 additions and 3 deletions

View File

@ -3277,6 +3277,7 @@ static void add_glsl_program_entry(struct shader_glsl_priv *priv, struct glsl_sh
static struct glsl_shader_prog_link *get_glsl_program_entry(struct shader_glsl_priv *priv, static struct glsl_shader_prog_link *get_glsl_program_entry(struct shader_glsl_priv *priv,
IWineD3DVertexShader *vshader, IWineD3DPixelShader *pshader, struct vs_compile_args *vs_args, IWineD3DVertexShader *vshader, IWineD3DPixelShader *pshader, struct vs_compile_args *vs_args,
struct ps_compile_args *ps_args) { struct ps_compile_args *ps_args) {
struct wine_rb_entry *entry;
glsl_program_key_t key; glsl_program_key_t key;
key.vshader = vshader; key.vshader = vshader;
@ -3284,8 +3285,8 @@ static struct glsl_shader_prog_link *get_glsl_program_entry(struct shader_glsl_p
key.vs_args = *vs_args; key.vs_args = *vs_args;
key.ps_args = *ps_args; key.ps_args = *ps_args;
return WINE_RB_ENTRY_VALUE(wine_rb_get(&priv->program_lookup, &key), entry = wine_rb_get(&priv->program_lookup, &key);
struct glsl_shader_prog_link, program_lookup_entry); return entry ? WINE_RB_ENTRY_VALUE(entry, struct glsl_shader_prog_link, program_lookup_entry) : NULL;
} }
/* GL locking is done by the caller */ /* GL locking is done by the caller */

View File

@ -2103,7 +2103,8 @@ void gen_ffp_frag_op(IWineD3DStateBlockImpl *stateblock, struct ffp_frag_setting
const struct ffp_frag_desc *find_ffp_frag_shader(const struct wine_rb_tree *fragment_shaders, const struct ffp_frag_desc *find_ffp_frag_shader(const struct wine_rb_tree *fragment_shaders,
const struct ffp_frag_settings *settings) const struct ffp_frag_settings *settings)
{ {
return WINE_RB_ENTRY_VALUE(wine_rb_get(fragment_shaders, settings), struct ffp_frag_desc, entry); struct wine_rb_entry *entry = wine_rb_get(fragment_shaders, settings);
return entry ? WINE_RB_ENTRY_VALUE(entry, struct ffp_frag_desc, entry) : NULL;
} }
void add_ffp_frag_shader(struct wine_rb_tree *shaders, struct ffp_frag_desc *desc) void add_ffp_frag_shader(struct wine_rb_tree *shaders, struct ffp_frag_desc *desc)