Fix error when decoding GPL file

Color without name are not added to the palette.
This commit is contained in:
Romain Giraud 2016-04-13 17:26:57 +02:00
parent b0f53324a7
commit ea06140be8

View File

@ -53,8 +53,11 @@ Palette* load_gpl_file(const char *filename)
std::istringstream lineIn(line);
// TODO add support to read the color name
lineIn >> r >> g >> b;
if (lineIn.good())
pal->addEntry(rgba(r, g, b, 255));
if (lineIn.fail())
continue;
pal->addEntry(rgba(r, g, b, 255));
}
return pal.release();