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:
committed by
Copybara-Service
parent
cd06629a92
commit
a1b39d5959
@@ -1633,7 +1633,7 @@ void UiEvent(mjuiState* state) {
|
|||||||
// 3D scroll
|
// 3D scroll
|
||||||
if (state->type==mjEVENT_SCROLL && state->mouserect==3) {
|
if (state->type==mjEVENT_SCROLL && state->mouserect==3) {
|
||||||
// emulate vertical mouse motion = 2% of window height
|
// 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);
|
mjv_moveCamera(sim->m_, mjMOUSE_ZOOM, 0, -zoom_increment*state->sy, &sim->scn, &sim->cam);
|
||||||
} else {
|
} else {
|
||||||
mjv_moveCameraFromState(
|
mjv_moveCameraFromState(
|
||||||
|
|||||||
Reference in New Issue
Block a user