added check to avoid out of range. Co-authored-by: Venkateshwar Reddy Kandula <vkandula@amd.com> [ROCm/rocprofiler-sdk commit: 8735ae4eb0]
8735ae4eb0