layers: Only save p-devices if call was successful
authorTony Barbour <tony@LunarG.com>
Tue, 13 Sep 2016 17:45:37 +0000 (11:45 -0600)
committerTony Barbour <tony@LunarG.com>
Wed, 14 Sep 2016 15:19:57 +0000 (09:19 -0600)
Change-Id: Ife211b1b2dc97c5bab0d6e7b177ead6b1a6105d3

layers/core_validation.cpp

index 3b73f27..0030793 100644 (file)
@@ -11238,7 +11238,7 @@ VKAPI_ATTR VkResult VKAPI_CALL EnumeratePhysicalDevices(VkInstance instance, uin
             my_data->instance_dispatch_table->EnumeratePhysicalDevices(instance, pPhysicalDeviceCount, pPhysicalDevices);
         if (NULL == pPhysicalDevices) {
             my_data->instance_state->physical_devices_count = *pPhysicalDeviceCount;
-        } else { // Save physical devices
+        } else if (result == VK_SUCCESS){ // Save physical devices
             for (uint32_t i = 0; i < *pPhysicalDeviceCount; i++) {
                 layer_data *phy_dev_data = get_my_data_ptr(get_dispatch_key(pPhysicalDevices[i]), layer_data_map);
                 phy_dev_data->physical_device_state = unique_ptr<PHYSICAL_DEVICE_STATE>(new PHYSICAL_DEVICE_STATE());