Fix bug in simulate where pressing '[' or ']' when a model is not loaded will causes a crash.
PiperOrigin-RevId: 436791755 Change-Id: I0bfec45eecef4bbb8db8f47f0d1e8a0276399b8f
This commit is contained in:
committed by
Saran Tunyasuvunakool
parent
df048e54c0
commit
21338e6178
+2
-2
@@ -1554,7 +1554,7 @@ void uiEvent(mjuiState* state) {
|
||||
break;
|
||||
|
||||
case ']': // cycle up fixed cameras
|
||||
if (m->ncam) {
|
||||
if (m && m->ncam) {
|
||||
cam.type = mjCAMERA_FIXED;
|
||||
// settings.camera = {0 or 1} are reserved for the free and tracking cameras
|
||||
if (settings.camera < 2 || settings.camera == 2 + m->ncam-1) {
|
||||
@@ -1568,7 +1568,7 @@ void uiEvent(mjuiState* state) {
|
||||
break;
|
||||
|
||||
case '[': // cycle down fixed cameras
|
||||
if (m->ncam) {
|
||||
if (m && m->ncam) {
|
||||
cam.type = mjCAMERA_FIXED;
|
||||
// settings.camera = {0 or 1} are reserved for the free and tracking cameras
|
||||
if (settings.camera <= 2) {
|
||||
|
||||
Reference in New Issue
Block a user