Move assertion into if-block.

Since the loop always goes up to MAX_VERTEX_ATTRIBS, the ASSERTION may be
triggered even though no more attributes are enabled.

BUG=angle:740

Change-Id: I2bb30d7e9f426ae1a0b8250e65c1fd02107973ac
Reviewed-on: https://chromium-review.googlesource.com/217027
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libGLESv2/renderer/d3d/DynamicHLSL.cpp b/src/libGLESv2/renderer/d3d/DynamicHLSL.cpp
index 63f06ab..c91008a 100644
--- a/src/libGLESv2/renderer/d3d/DynamicHLSL.cpp
+++ b/src/libGLESv2/renderer/d3d/DynamicHLSL.cpp
@@ -365,13 +365,12 @@
 
     for (unsigned int attributeIndex = 0; attributeIndex < MAX_VERTEX_ATTRIBS; attributeIndex++)
     {
-        ASSERT(inputIndex < MAX_VERTEX_ATTRIBS);
-
-        const VertexFormat &vertexFormat = inputLayout[inputIndex];
         const sh::Attribute &shaderAttribute = shaderAttributes[attributeIndex];
-
         if (!shaderAttribute.name.empty())
         {
+            ASSERT(inputIndex < MAX_VERTEX_ATTRIBS);
+            const VertexFormat &vertexFormat = inputLayout[inputIndex];
+
             // HLSL code for input structure
             if (IsMatrixType(shaderAttribute.type))
             {