diff options
-rw-r--r-- | src/armnn/Profiling.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/armnn/Profiling.cpp b/src/armnn/Profiling.cpp index e18bf475d1..805b61e8ef 100644 --- a/src/armnn/Profiling.cpp +++ b/src/armnn/Profiling.cpp @@ -345,10 +345,14 @@ void ExtractJsonObjects(unsigned int inferenceIndex, parentObject.AddChild(childObject); } - // Recursively process children. In reality this won't be very deep recursion. ~4-6 levels deep. - ExtractJsonObjects(inferenceIndex, childEvent, parentObject.GetChild(childIdx), descendantsMap); - - childIdx++; + // It's possible that childIdx can overrun the parents' child vector. Check before we try to process a + // non-existent child. + if (childIdx < parentObject.NumChildren()) + { + // Recursively process children. + ExtractJsonObjects(inferenceIndex, childEvent, parentObject.GetChild(childIdx), descendantsMap); + childIdx++; + } } } } |