Copy default spec before assigning defaults.

PiperOrigin-RevId: 609766747
Change-Id: I79ebff62928ac2ffa5133020ee8bd001b68cdcd3
This commit is contained in:
Alessio Quaglino
2024-02-23 10:22:42 -08:00
committed by Copybara-Service
parent ce52047c6f
commit c6a41fbfe6
3 changed files with 19 additions and 0 deletions
+1
View File
@@ -541,6 +541,7 @@ mjCDef* mjCModel::AddDef(string name, int parentid) {
// initialize contents
if (parentid>=0 && parentid<thisid) {
defaults[parentid]->CopyFromSpec();
*def = *defaults[parentid];
defaults[parentid]->childid.push_back(thisid);
}