Fix possible nullptr dereferencing in material parsing
* Return 0.0f for empty buffer * closes https://github.com/assimp/assimp/issues/3442
This commit is contained in:
@@ -232,6 +232,12 @@ void ObjFileMtlImporter::getIlluminationModel(int &illum_model) {
|
||||
// Loads a single float value.
|
||||
void ObjFileMtlImporter::getFloatValue(ai_real &value) {
|
||||
m_DataIt = CopyNextWord<DataArrayIt>(m_DataIt, m_DataItEnd, &m_buffer[0], BUFFERSIZE);
|
||||
size_t len = std::strlen(&m_buffer[0]);
|
||||
if (0 == len) {
|
||||
value = 0.0f;
|
||||
return;
|
||||
}
|
||||
|
||||
value = (ai_real)fast_atof(&m_buffer[0]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user