Merge pull request #3068 from ms-maxvollmer/GLTF2_invalid_buffer_fix
GLTF2: ExtractData now throws exception instead of returning false if data is invalidpull/3070/head^2
commit
1e74fe85bf
|
@ -376,7 +376,7 @@ struct Accessor : public Object {
|
|||
inline uint8_t *GetPointer();
|
||||
|
||||
template<class T>
|
||||
bool ExtractData(T *&outData);
|
||||
void ExtractData(T *&outData);
|
||||
|
||||
void WriteData(size_t count, const void *src_buffer, size_t src_stride);
|
||||
|
||||
|
|
|
@ -614,9 +614,12 @@ inline void CopyData(size_t count,
|
|||
} // namespace
|
||||
|
||||
template<class T>
|
||||
bool Accessor::ExtractData(T *&outData) {
|
||||
void Accessor::ExtractData(T *&outData)
|
||||
{
|
||||
uint8_t* data = GetPointer();
|
||||
if (!data) return false;
|
||||
if (!data) {
|
||||
throw DeadlyImportError("GLTF: data is NULL");
|
||||
}
|
||||
|
||||
const size_t elemSize = GetElementSize();
|
||||
const size_t totalSize = elemSize * count;
|
||||
|
@ -636,8 +639,6 @@ bool Accessor::ExtractData(T *&outData) {
|
|||
memcpy(outData + i, data + i * stride, elemSize);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
inline void Accessor::WriteData(size_t _count, const void *src_buffer, size_t src_stride) {
|
||||
|
|
Loading…
Reference in New Issue