From ea06140be8307ed1a6204037f25026bbd7ef1504 Mon Sep 17 00:00:00 2001 From: Romain Giraud Date: Wed, 13 Apr 2016 17:26:57 +0200 Subject: [PATCH] Fix error when decoding GPL file Color without name are not added to the palette. --- src/doc/file/gpl_file.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/doc/file/gpl_file.cpp b/src/doc/file/gpl_file.cpp index a9d417455..87b3dbc26 100644 --- a/src/doc/file/gpl_file.cpp +++ b/src/doc/file/gpl_file.cpp @@ -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();