gallium: Check for OOM condition when creating a sampler view.
[mesa.git] / src / gallium / drivers / nv30 / nv30_state.c
index 321575da0a9462c7ffa7ea3a4eafcba3c7ef5a57..fb3075f4c814165c766310bbdb9ebe45a5074dbf 100644 (file)
@@ -304,11 +304,13 @@ nv30_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;
 }