anv: Properly handle destroying NULL devices and instances

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: "17.0 13.0" <mesa-dev@lists.freedesktop.org>
(cherry picked from commit e3d33a23e6cbe2b73b412a56bb4fc4aa6852d081)
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 67323e0..d7235ed 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -362,6 +362,9 @@
 {
    ANV_FROM_HANDLE(anv_instance, instance, _instance);
 
+   if (!instance)
+      return;
+
    if (instance->physicalDeviceCount > 0) {
       /* We support at most one physical device. */
       assert(instance->physicalDeviceCount == 1);
@@ -1006,6 +1009,9 @@
 {
    ANV_FROM_HANDLE(anv_device, device, _device);
 
+   if (!device)
+      return;
+
    anv_device_finish_blorp(device);
 
    anv_queue_finish(&device->queue);