Fix column title tooltip crash.

This commit is contained in:
Mounir Tohami 2025-10-05 17:48:21 +03:00
parent 06827c91c6
commit 5a8c3bb0de

View file

@ -6403,14 +6403,15 @@ String Tree::get_tooltip(const Point2 &p_pos) const {
// Walk forwards until we know which column we're in. // Walk forwards until we know which column we're in.
int next_edge = 0; int next_edge = 0;
int i = 0; int i = 0;
for (; i < columns.size(); i++) { for (const ColumnInfo &column : columns) {
next_edge += get_column_width(i++);
if (pos_x < next_edge) { if (pos_x < next_edge) {
if (!column.title_tooltip.is_empty()) {
return column.title_tooltip;
}
break; break;
} }
next_edge += get_column_width(i);
}
if (!columns[i - 1].title_tooltip.is_empty()) {
return columns[i - 1].title_tooltip;
} }
// If the column has no tooltip, use the default. // If the column has no tooltip, use the default.