Fix a segfault in simulate on mouse scroll without a loaded model.

Fixes #1089

PiperOrigin-RevId: 571985561
Change-Id: I4acc7c2a6032d678023783646c3f00cfe30641f2
This commit is contained in:
Saran Tunyasuvunakool
2023-10-09 11:00:14 -07:00
committed by Copybara-Service
parent cd06629a92
commit a1b39d5959
+1 -1
View File
@@ -1633,7 +1633,7 @@ void UiEvent(mjuiState* state) {
// 3D scroll
if (state->type==mjEVENT_SCROLL && state->mouserect==3) {
// emulate vertical mouse motion = 2% of window height
if (!sim->is_passive_) {
if (sim->m_ && !sim->is_passive_) {
mjv_moveCamera(sim->m_, mjMOUSE_ZOOM, 0, -zoom_increment*state->sy, &sim->scn, &sim->cam);
} else {
mjv_moveCameraFromState(