Allow passing a null pointer in mj_recompile.
Fixes #1819. PiperOrigin-RevId: 653242587 Change-Id: I36dbd6ed54abdf21abeb62cf41ee88f159008d01
This commit is contained in:
committed by
Copybara-Service
parent
a2fd34caee
commit
2664cc1391
@@ -86,9 +86,14 @@ mjModel* mj_compile(mjSpec* s, const mjVFS* vfs) {
|
||||
// recompile spec into existing model and data while preserving the state
|
||||
void mj_recompile(mjSpec* s, const mjVFS* vfs, mjModel* m, mjData* d) {
|
||||
mjCModel* modelC = static_cast<mjCModel*>(s->element);
|
||||
modelC->SaveState(d);
|
||||
if (d) {
|
||||
modelC->SaveState(d->qpos, d->qvel, d->act);
|
||||
}
|
||||
modelC->Compile(vfs, &m);
|
||||
modelC->RestoreState(m, &d);
|
||||
if (d) {
|
||||
modelC->MakeData(m, &d);
|
||||
modelC->RestoreState(d->qpos, d->qvel, d->act);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user