Merge pull request #1461 from jfaust/master
Fix possible infinite loop when exporting to gltf2pull/1462/head^2
commit
87546ec54c
|
@ -1118,11 +1118,12 @@ inline std::string Asset::FindUniqueID(const std::string& str, const char* suffi
|
||||||
if (it == mUsedIds.end())
|
if (it == mUsedIds.end())
|
||||||
return id;
|
return id;
|
||||||
|
|
||||||
char buffer[256];
|
std::vector<char> buffer;
|
||||||
int offset = ai_snprintf(buffer, sizeof(buffer), "%s_", id.c_str());
|
buffer.resize(id.size() + 16);
|
||||||
|
int offset = ai_snprintf(buffer.data(), buffer.size(), "%s_", id.c_str());
|
||||||
for (int i = 0; it != mUsedIds.end(); ++i) {
|
for (int i = 0; it != mUsedIds.end(); ++i) {
|
||||||
ai_snprintf(buffer + offset, sizeof(buffer) - offset, "%d", i);
|
ai_snprintf(buffer.data() + offset, buffer.size() - offset, "%d", i);
|
||||||
id = buffer;
|
id = buffer.data();
|
||||||
it = mUsedIds.find(id);
|
it = mUsedIds.find(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue