OpenGEX: Throw exception on malformed color4 instead of crashing

pull/1656/head
Turo Lamminen 2017-12-24 14:57:14 +02:00
parent 7932a85ca1
commit 4078543827
1 changed files with 12 additions and 0 deletions

View File

@ -778,10 +778,22 @@ static void fillColor4( aiColor4D *col4, Value *vals ) {
Value *next( vals );
col4->r = next->getFloat();
next = next->m_next;
if (!next) {
throw DeadlyImportError( "OpenGEX: Not enough values to fill 4-element color, only 1" );
}
col4->g = next->getFloat();
next = next->m_next;
if (!next) {
throw DeadlyImportError( "OpenGEX: Not enough values to fill 4-element color, only 2" );
}
col4->b = next->getFloat();
next = next->m_next;
if (!next) {
throw DeadlyImportError( "OpenGEX: Not enough values to fill 4-element color, only 3" );
}
col4->a = next->getFloat();
}