Fix #30230, Crash after importing collada file
authorJuha Mäki-Kanto <ih5235252@gmail.com>
Sun, 19 Feb 2012 17:55:09 +0000 (17:55 +0000)
committerJuha Mäki-Kanto <ih5235252@gmail.com>
Sun, 19 Feb 2012 17:55:09 +0000 (17:55 +0000)
On collada import a -1 layer_index from CustomData_get_layer_index (CD_MTFACE) was used.
This then managed to overwrite last mface's data with uv-set's name so at least it gave a clue where to look for :]

source/blender/collada/MeshImporter.cpp

index 1e5783f8ad0e83e064c5dd98ce75923ca76b8487..92852120bca31abaf9bfcf021c0e48ea6fd822fa 100644 (file)
@@ -746,6 +746,9 @@ MTex *MeshImporter::assign_textures_to_uvlayer(COLLADAFW::TextureCoordinateBindi
        
        const CustomData *data = &me->fdata;
        int layer_index = CustomData_get_layer_index(data, CD_MTFACE);
        
        const CustomData *data = &me->fdata;
        int layer_index = CustomData_get_layer_index(data, CD_MTFACE);
+
+       if(layer_index == -1) return NULL;
+
        CustomDataLayer *cdl = &data->layers[layer_index+setindex];
        
        /* set uvname to bind_vertex_input semantic */
        CustomDataLayer *cdl = &data->layers[layer_index+setindex];
        
        /* set uvname to bind_vertex_input semantic */