AMFImporter: make test against nullptr dereferencing meaningful.
parent
f77e27ca19
commit
4a5c483ac4
|
@ -261,20 +261,19 @@ size_t AMFImporter::PostprocessHelper_GetTextureID_Or_Create(const std::string&
|
|||
size_t off_b = 0;
|
||||
|
||||
// Calculate size of the target array and rule how data will be copied.
|
||||
if ( nullptr != src_texture ) {
|
||||
if(!pID_R.empty()) {
|
||||
if(!pID_R.empty() && nullptr != src_texture[ 0 ] ) {
|
||||
tex_size += src_texture[0]->Data.size(); step++, off_g++, off_b++;
|
||||
}
|
||||
if(!pID_G.empty()) {
|
||||
if(!pID_G.empty() && nullptr != src_texture[ 1 ] ) {
|
||||
tex_size += src_texture[1]->Data.size(); step++, off_b++;
|
||||
}
|
||||
if(!pID_B.empty()) {
|
||||
if(!pID_B.empty() && nullptr != src_texture[ 2 ] ) {
|
||||
tex_size += src_texture[2]->Data.size(); step++;
|
||||
}
|
||||
if(!pID_A.empty()) {
|
||||
if(!pID_A.empty() && nullptr != src_texture[ 3 ] ) {
|
||||
tex_size += src_texture[3]->Data.size(); step++;
|
||||
}
|
||||
}
|
||||
|
||||
// Create target array.
|
||||
converted_texture.Data = new uint8_t[tex_size];
|
||||
// And copy data
|
||||
|
|
Loading…
Reference in New Issue