Skip to content

Commit e8535bc

Browse files
committed
Merge pull request godotengine#111292 from WhalesState/tree-tooltip-crash
Fix Tree column title tooltip crash.
2 parents d364dac + 5a8c3bb commit e8535bc

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

scene/gui/tree.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6404,14 +6404,15 @@ String Tree::get_tooltip(const Point2 &p_pos) const {
64046404
// Walk forwards until we know which column we're in.
64056405
int next_edge = 0;
64066406
int i = 0;
6407-
for (; i < columns.size(); i++) {
6407+
for (const ColumnInfo &column : columns) {
6408+
next_edge += get_column_width(i++);
6409+
64086410
if (pos_x < next_edge) {
6411+
if (!column.title_tooltip.is_empty()) {
6412+
return column.title_tooltip;
6413+
}
64096414
break;
64106415
}
6411-
next_edge += get_column_width(i);
6412-
}
6413-
if (!columns[i - 1].title_tooltip.is_empty()) {
6414-
return columns[i - 1].title_tooltip;
64156416
}
64166417

64176418
// If the column has no tooltip, use the default.

0 commit comments

Comments
 (0)