Merge pull request #2849 from jeremy-lunarg/hayes-fix-issue-2848

Fix seg fault
This commit is contained in:
Greg Fischer 2022-01-03 16:39:45 -07:00 committed by GitHub
commit 950c6ddc11
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 78 additions and 3 deletions

View file

@ -2446,11 +2446,15 @@ public:
//
bool sameStructType(const TType& right) const
{
// TODO: Why return true when neither types are structures?
// Most commonly, they are both nullptr, or the same pointer to the same actual structure
if ((!isStruct() && !right.isStruct()) ||
(isStruct() && right.isStruct() && structure == right.structure))
return true;
if (!isStruct() || !right.isStruct())
return false;
// Structure names have to match
if (*typeName != *right.typeName)
return false;
@ -2460,8 +2464,7 @@ public:
bool isGLPerVertex = *typeName == "gl_PerVertex";
// Both being nullptr was caught above, now they both have to be structures of the same number of elements
if (!isStruct() || !right.isStruct() ||
(structure->size() != right.structure->size() && !isGLPerVertex))
if (structure->size() != right.structure->size() && !isGLPerVertex)
return false;
// Compare the names and types of all the members, which have to match