We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8b94bd0 commit 60f9b34Copy full SHA for 60f9b34
python/mujoco/structs.cc
@@ -728,7 +728,12 @@ This is useful for example when the MJB is not available as a file on disk.)"));
728
729
// ==================== MJDATA ===============================================
730
py::class_<MjDataWrapper> mjData(m, "MjData");
731
- mjData.def(py::init<MjModelWrapper*>());
+ mjData.def(py::init([](MjModelWrapper* m) {
732
+ if (!m) {
733
+ throw py::type_error("MjModel cannot be None");
734
+ }
735
+ return MjDataWrapper(m);
736
+ }));
737
mjData.def_property_readonly("_address", [](const MjDataWrapper& d) {
738
return reinterpret_cast<std::uintptr_t>(d.get());
739
});
0 commit comments