Fix use of uninitialized value in ValidateTextureViewDescriptor

ValidateTextureViewDescriptor was running into use of uninitialized
value. Fixing this by moving the texture state check below the texture
object check. This should validate the texture object before trying to
validate it's texture state.

Bug: chromium:947150
Change-Id: I9b41791bfb960fbe4873ba5fcadf046bd32e5853
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/6180
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Natasha Lee <natlee@microsoft.com>
diff --git a/src/dawn_native/Texture.cpp b/src/dawn_native/Texture.cpp
index 223d855..573269c 100644
--- a/src/dawn_native/Texture.cpp
+++ b/src/dawn_native/Texture.cpp
@@ -182,11 +182,12 @@
         if (descriptor->nextInChain != nullptr) {
             return DAWN_VALIDATION_ERROR("nextInChain must be nullptr");
         }
+
+        DAWN_TRY(device->ValidateObject(texture));
         if (texture->GetTextureState() == TextureBase::TextureState::Destroyed) {
             return DAWN_VALIDATION_ERROR("Destroyed texture used to create texture view");
         }
 
-        DAWN_TRY(device->ValidateObject(texture));
         DAWN_TRY(ValidateTextureViewDimension(descriptor->dimension));
         DAWN_TRY(ValidateTextureFormat(descriptor->format));