Added some extra checks to be more tolerant for configration faults

Former-commit-id: 5061311d8116f848f36808f2c77dcff011ceb571
This commit is contained in:
johan
2013-10-16 23:19:40 +02:00
parent d50aec63f7
commit 64b9316a04
5 changed files with 379 additions and 363 deletions

View File

@@ -85,6 +85,11 @@ void ImageToLedsMap::getMeanLedColor(const RgbImage & image, std::vector<RgbColo
RgbColor ImageToLedsMap::calcMeanColor(const RgbImage & image, const std::vector<unsigned> & colors) const
{
if (colors.size() == 0)
{
return RgbColor::BLACK;
}
// Accumulate the sum of each seperate color channel
uint_fast16_t cummRed = 0;
uint_fast16_t cummGreen = 0;