Fix NULL pointer dereference when scroll-wheeling in the editor

From cd8c83532b:

  gui::slider* s = gui().find_slider("map-zoom-slider");
  if (point_in_rect(event.x, event.y, s->location())) {
      scrollx = 0; scrolly = 0;
  }

s is not guaranteed to not be NULL. display::find_slider() WILL return
NULL if it can't find the requested widget. As it turns out, the editor
currently lacks a slider called "map-zoom-slider".
This commit is contained in:
Ignacio R. Morelle 2013-12-21 14:34:13 -03:00
parent e6c2e9ad18
commit 25266cd2f6

View file

@ -197,7 +197,7 @@ void mouse_handler_base::mouse_press(const SDL_MouseButtonEvent& event, const bo
}
// Don't scroll map and map zoom slider at same time
gui::slider* s = gui().find_slider("map-zoom-slider");
if (point_in_rect(event.x, event.y, s->location())) {
if (s && point_in_rect(event.x, event.y, s->location())) {
scrollx = 0; scrolly = 0;
}
}