From 62f8c5346b2f3ea492404ae85942a0de4b091c71 Mon Sep 17 00:00:00 2001 From: albert-github Date: Tue, 4 Dec 2018 13:17:19 +0100 Subject: issue #6657 "QGDict::hashAsciiKey: Invalid null key" when using anonymous union/struct Protect findAt against empty string. --- src/groupdef.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/groupdef.cpp b/src/groupdef.cpp index e918b1f..9df3ae1 100644 --- a/src/groupdef.cpp +++ b/src/groupdef.cpp @@ -170,7 +170,8 @@ bool GroupDef::addClass(const ClassDef *cd) // add nested classes (e.g. A::B, A::C) after their parent (A) in // order of insertion QCString scope = qn.left(i); - int j=classSDict->findAt(scope); + int j=-1; + if (!scope.isEmpty()) j=classSDict->findAt(scope); if (j!=-1) { while (j<(int)classSDict->count() && -- cgit v0.12 From f194a3165042428359ec5b5af7e9bad7878c0536 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Tue, 4 Dec 2018 20:58:07 +0100 Subject: Further simplified the fix --- src/groupdef.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/groupdef.cpp b/src/groupdef.cpp index 9df3ae1..e543d16 100644 --- a/src/groupdef.cpp +++ b/src/groupdef.cpp @@ -165,13 +165,12 @@ bool GroupDef::addClass(const ClassDef *cd) if (i==-1) i=qn.find('.'); bool found=FALSE; //printf("i=%d\n",i); - if (i!=-1) + if (i>0) { // add nested classes (e.g. A::B, A::C) after their parent (A) in // order of insertion QCString scope = qn.left(i); - int j=-1; - if (!scope.isEmpty()) j=classSDict->findAt(scope); + int j=classSDict->findAt(scope); if (j!=-1) { while (j<(int)classSDict->count() && -- cgit v0.12