mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
Tabbar::GetTabBar(): bounds-checking implemented. (#121)
This commit is contained in:
parent
861b26d694
commit
58cfe3a9c0
1 changed files with 6 additions and 2 deletions
|
|
@ -2234,6 +2234,10 @@ int TabBar::GetTargetTab(Point p)
|
|||
|
||||
int f = GetFirst();
|
||||
int l = GetLast();
|
||||
int n = tabs.GetCount();
|
||||
|
||||
if(f < 0 || f >= n || l < 0 || l >= n)
|
||||
return -1;
|
||||
|
||||
if(tabs[f].visible && p.x < tabs[f].pos.x + tabs[f].size.cx / 2)
|
||||
return f;
|
||||
|
|
@ -2251,9 +2255,9 @@ int TabBar::GetTargetTab(Point p)
|
|||
l = FindStackHead(tabs[l].stack);
|
||||
|
||||
if(t == l)
|
||||
t = tabs.GetCount();
|
||||
t = n;
|
||||
else
|
||||
t = GetNext(t);
|
||||
t = GetNext(t);
|
||||
|
||||
return t;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue