summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/i915/i915_state.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/i915/i915_state.c')
-rw-r--r--src/gallium/drivers/i915/i915_state.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c
index 884abe622b3..e54997736f9 100644
--- a/src/gallium/drivers/i915/i915_state.c
+++ b/src/gallium/drivers/i915/i915_state.c
@@ -598,11 +598,13 @@ i915_create_sampler_view(struct pipe_context *pipe,
{
struct pipe_sampler_view *view = CALLOC_STRUCT(pipe_sampler_view);
- *view = *templ;
- view->reference.count = 1;
- view->texture = NULL;
- pipe_texture_reference(&view->texture, texture);
- view->context = pipe;
+ if (view) {
+ *view = *templ;
+ view->reference.count = 1;
+ view->texture = NULL;
+ pipe_texture_reference(&view->texture, texture);
+ view->context = pipe;
+ }
return view;
}