Fix accessing the name of a nested struct definition

When generating an error message about the struct nesting limit, the
code should make sure that the struct definitions are not nested.
While nested struct definitions by themselves are also an error,
they're not a syntax error so parsing will continue after encountering
them.

This fixes a regression from commit: Don't allocate name strings for
empty symbols.

BUG=chromium:797156
TEST=angle_unittests

Change-Id: I4149fbe874c0e7ec90e690aec078ccaf7313eab0
Reviewed-on: https://chromium-review.googlesource.com/842643
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/compiler/translator/ParseContext.cpp b/src/compiler/translator/ParseContext.cpp
index c118cee..5aa6882 100644
--- a/src/compiler/translator/ParseContext.cpp
+++ b/src/compiler/translator/ParseContext.cpp
@@ -3896,10 +3896,19 @@
     // one to the field's struct nesting.
     if (1 + field.type()->getDeepestStructNesting() > kWebGLMaxStructNesting)
     {
-        ASSERT(field.type()->getStruct()->name() != nullptr);
         std::stringstream reasonStream;
-        reasonStream << "Reference of struct type " << field.type()->getStruct()->name()->c_str()
-                     << " exceeds maximum allowed nesting level of " << kWebGLMaxStructNesting;
+        if (field.type()->getStruct()->symbolType() == SymbolType::Empty)
+        {
+            // This may happen in case there are nested struct definitions. While they are also
+            // invalid GLSL, they don't cause a syntax error.
+            reasonStream << "Struct nesting";
+        }
+        else
+        {
+            reasonStream << "Reference of struct type "
+                         << field.type()->getStruct()->name()->c_str();
+        }
+        reasonStream << " exceeds maximum allowed nesting level of " << kWebGLMaxStructNesting;
         std::string reason = reasonStream.str();
         error(line, reason.c_str(), field.name().c_str());
         return;