From a40d61b72fa04b98c757bc5a37e223c6964c1fa9 Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 21 Dec 2022 12:28:02 +0000 Subject: [PATCH] Don't access invalid counter description for EID column in counter view --- qrenderdoc/Windows/PerformanceCounterViewer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qrenderdoc/Windows/PerformanceCounterViewer.cpp b/qrenderdoc/Windows/PerformanceCounterViewer.cpp index 248db4de8..3797e594c 100644 --- a/qrenderdoc/Windows/PerformanceCounterViewer.cpp +++ b/qrenderdoc/Windows/PerformanceCounterViewer.cpp @@ -182,11 +182,11 @@ public: if((role == Qt::DisplayRole && col == 0) || role == EIDRole) return (qulonglong)getData(row, 0).u; - const CounterDescription &desc = m_Descriptions[col - 1]; + const CounterDescription &desc = m_Descriptions[qMax(1, col) - 1]; if(role == SortDataRole) { - if(desc.resultType == CompType::UInt) + if(col == 0 || desc.resultType == CompType::UInt) return (qulonglong)getData(row, col).u; else return getData(row, col).f; @@ -194,7 +194,7 @@ public: if(role == Qt::DisplayRole) { - if(desc.resultType == CompType::UInt) + if(col == 0 || desc.resultType == CompType::UInt) return (qulonglong)getData(row, col).u; double val = getData(row, col).f;