Fix out of bounds access for buggy UIs

Seen with the main menu on the mod 'Classic Doom 3'.
This commit is contained in:
dhewg 2012-01-12 18:56:22 +01:00
parent 3e07208cae
commit 91bca094c0

View file

@ -387,22 +387,22 @@ void idListWindow::PostParse() {
r.x = tabStops[i];
r.w = (i < c - 1) ? tabStops[i+1] - r.x - tabBorder : -1;
r.align = (doAligns) ? tabAligns[i] : 0;
if(tabVAligns.Num() > 0) {
if(tabVAligns.Num() > 0 && i < tabVAligns.Num()) {
r.valign = tabVAligns[i];
} else {
r.valign = 0;
}
if(tabTypes.Num() > 0) {
if(tabTypes.Num() > 0 && i < tabTypes.Num()) {
r.type = tabTypes[i];
} else {
r.type = TAB_TYPE_TEXT;
}
if(tabSizes.Num() > 0) {
if(tabSizes.Num() > 0 && i < tabSizes.Num() ) {
r.iconSize = tabSizes[i];
} else {
r.iconSize.Zero();
}
if(tabIconVOffsets.Num() > 0 ) {
if(tabIconVOffsets.Num() > 0 && i < tabIconVOffsets.Num()) {
r.iconVOffset = tabIconVOffsets[i];
} else {
r.iconVOffset = 0;