From 7d03c720e909d4b620bde26ebc78eb4d37557db5 Mon Sep 17 00:00:00 2001
From: Christian Costa <titan.costa@gmail.com>
Date: Fri, 13 Mar 2015 23:42:20 +0100
Subject: d3d9/tests: Avoid crash when surface and texture creation fails.

---
 dlls/d3d9/tests/device.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index 89ea7721bf1..8624ac3153c 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -8583,8 +8583,14 @@ static void test_surface_blocks(void)
                     break;
 
                 default:
+                    hr = E_FAIL;
                     break;
             }
+            if (FAILED(hr))
+            {
+                skip("Failed to create surface, skipping tests.\n");
+                continue;
+            }
 
             if (formats[i].block_width > 1)
             {
@@ -9534,6 +9540,11 @@ static void test_volume_blocks(void)
         hr = IDirect3DDevice9_CreateVolumeTexture(device, 24, 8, 8, 1, 0,
                 formats[i].fmt, D3DPOOL_SCRATCH, &texture, NULL);
         ok(SUCCEEDED(hr), "Failed to create volume texture, hr %#x.\n", hr);
+        if (FAILED(hr))
+        {
+            skip("Failed to create texture, skipping tests.\n");
+            continue;
+        }
 
         /* Test lockrect offset */
         for (j = 0; j < ARRAY_SIZE(offset_tests); j++)
-- 
2.12.2