Add termination character to flattened plugin attributes if empty.

Fixes #2450.

PiperOrigin-RevId: 730521722
Change-Id: Iec3fa377c65693d782eeb766a144a1c89096d1f3
This commit is contained in:
Alessio Quaglino
2025-02-24 11:06:27 -08:00
committed by Copybara-Service
parent 024616345d
commit 14c8dc62f0
2 changed files with 65 additions and 4 deletions
+5
View File
@@ -7157,6 +7157,11 @@ void mjCPlugin::Compile(void) {
}
}
// if there are no attributes, add a null terminator
if (plugin->nattribute == 0) {
flattened_attributes.push_back('\0');
}
// anything left in xml_attributes at this stage is not a valid attribute
if (!config_attribs_copy.empty()) {
std::string error =