Add check for height fields size during compilation.
Fixes #2427. PiperOrigin-RevId: 727805729 Change-Id: Idf3192e5fb238249faaeae6b4fb9de4c55755d96
This commit is contained in:
committed by
Copybara-Service
parent
78a4d2f389
commit
7f11a0df12
@@ -3696,6 +3696,9 @@ void mjCHField::Compile(const mjVFS* vfs) {
|
||||
|
||||
// copy userdata into data
|
||||
if (!userdata_.empty()) {
|
||||
if (nrow*ncol != userdata_.size()) {
|
||||
throw mjCError(this, "elevation data length must match nrow*ncol");
|
||||
}
|
||||
data.assign(nrow*ncol, 0);
|
||||
if (data.empty()) {
|
||||
throw mjCError(this, "could not allocate buffers in hfield");
|
||||
|
||||
Reference in New Issue
Block a user