Check mjs_getName return value in XML parser. Fixes #2898.

PiperOrigin-RevId: 819351410
Change-Id: I0807d71328068f6388991ae15274c7d61b4d3e53
This commit is contained in:
Alessio Quaglino
2025-10-14 12:38:51 -07:00
committed by Copybara-Service
parent 67960543a0
commit b6f25ca623
11 changed files with 152 additions and 63 deletions
+4
View File
@@ -279,6 +279,10 @@ mjsElement* mjs_attach(mjsElement* parent, const mjsElement* child,
// get error message from model
const char* mjs_getError(mjSpec* s) {
if (!s) {
mju_error("spec is null");
return nullptr;
}
mjCModel* modelC = static_cast<mjCModel*>(s->element);
return modelC->GetError().message;
}