From e80cc173ef63823b7d1d27905eba71495a452b1c Mon Sep 17 00:00:00 2001 From: Christian Gmeiner Date: Mon, 28 Sep 2009 19:56:26 +0200 Subject: check num pararmeter of section(..) so that we are on the safe side. Also move a call under an if. --- spuregion.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/spuregion.c b/spuregion.c index b2a6526..afa40da 100644 --- a/spuregion.c +++ b/spuregion.c @@ -51,7 +51,7 @@ bool cSpuRegion::newSection() sSection *cSpuRegion::section(uint8_t num) { - if (usedSections == MAX_SECTIONS) { + if (num >= MAX_SECTIONS) { return NULL; } @@ -60,12 +60,11 @@ sSection *cSpuRegion::section(uint8_t num) bool cSpuRegion::addIndex(tIndex idx) { - sSection *sec = §ions[usedSections]; - if (containsIndex(idx)) { return true; } + sSection *sec = §ions[usedSections]; if (sec->usedColors == MAX_COLORS) { return false; } -- cgit v1.2.3