mirror of
https://github.com/lucaspalomodevelop/meshlab.git
synced 2026-03-20 03:16:10 +00:00
fix crash when saving mesh with texture without changing txtname
This commit is contained in:
parent
2b475c7344
commit
0cd47744cb
@ -175,13 +175,15 @@ void MeshModel::changeTextureName(
|
||||
const std::string& oldName,
|
||||
std::string newName)
|
||||
{
|
||||
auto mit = textures.find(oldName);
|
||||
auto tit = std::find(cm.textures.begin(), cm.textures.end(), oldName);
|
||||
if (mit != textures.end() && tit != cm.textures.end()){
|
||||
*tit = newName;
|
||||
if (oldName != newName) {
|
||||
auto mit = textures.find(oldName);
|
||||
auto tit = std::find(cm.textures.begin(), cm.textures.end(), oldName);
|
||||
if (mit != textures.end() && tit != cm.textures.end()){
|
||||
*tit = newName;
|
||||
|
||||
textures[newName] = mit->second;
|
||||
textures.erase(mit);
|
||||
textures[newName] = mit->second;
|
||||
textures.erase(mit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user