Fixes ProfilerViewer when drawing empty cells

Currently CalculateStringSize can't handle empty string (see #8630).
As a simple fix for RC just avoid drawing empty texts.

Refs: #8630
(cherry picked from commit df9c6f510c)
Signed-off-by: phosit <phosit@autistici.org>
This commit is contained in:
Vladislav Belov
2025-12-28 17:36:36 +01:00
committed by phosit
parent 7d2647d59a
commit d93722a023
+10 -8
View File
@@ -240,15 +240,17 @@ void CProfileViewer::RenderProfile(CCanvas2D& canvas)
float rowColX = 0.0f;
for (size_t col = 0; col < columns.size(); ++col)
{
CStrW text = table->GetCellText(row, col).FromUTF8();
float w, h;
font.CalculateStringSize(text.c_str(), w, h);
float x = rowColX;
if (col > 0) // right-align all but the first column
x += columns[col].width - w;
textRenderer.Put(x, 0.0f, text.c_str());
const CStrW text{table->GetCellText(row, col).FromUTF8()};
if (!text.empty())
{
float w, h;
font.CalculateStringSize(text.c_str(), w, h);
float x = rowColX;
if (col > 0) // right-align all but the first column
x += columns[col].width - w;
textRenderer.Put(x, 0.0f, text.c_str());
}
rowColX += columns[col].width;
}