浏览代码

fixed potential null pointer bug

jp9000 12 年之前
父节点
当前提交
31dd23cb0d
共有 1 个文件被更改,包括 1 次插入2 次删除
  1. 1 2
      libobs-opengl/gl-subsystem.c

+ 1 - 2
libobs-opengl/gl-subsystem.c

@@ -247,10 +247,9 @@ void device_load_texture(device_t device, texture_t tex, int unit)
 	if (!gl_active_texture(GL_TEXTURE0 + unit))
 	if (!gl_active_texture(GL_TEXTURE0 + unit))
 		goto fail;
 		goto fail;
 
 
-	if (cur_tex && cur_tex->gl_target != tex->gl_target)
+	if (!tex || (cur_tex && cur_tex->gl_target != tex->gl_target))
 		gl_bind_texture(cur_tex->gl_target, 0);
 		gl_bind_texture(cur_tex->gl_target, 0);
 
 
-
 	device->cur_textures[unit] = tex;
 	device->cur_textures[unit] = tex;
 	param = get_texture_param(device, unit);
 	param = get_texture_param(device, unit);
 	if (!param)
 	if (!param)