From 40a24638a8e9186646fab1155c1f62e1be35d32e Mon Sep 17 00:00:00 2001 From: "p.kosyh" Date: Thu, 21 Jan 2010 13:55:01 +0000 Subject: [PATCH] segfault fix --- src/sdl-instead/game.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/sdl-instead/game.c b/src/sdl-instead/game.c index a7c1522..77d023a 100644 --- a/src/sdl-instead/game.c +++ b/src/sdl-instead/game.c @@ -1534,7 +1534,7 @@ int game_highlight(int x, int y, int on) static struct el *oel = NULL; static xref_t hxref = NULL; xref_t xref = NULL; - if (on) { + if (on == 1) { xref = look_xref(x, y, &elem); if (xref && opt_hl && !xref_get_active(xref)) { xref_set_active(xref, 1); @@ -1545,7 +1545,8 @@ int game_highlight(int x, int y, int on) if (hxref != xref && oel) { if (hxref != use_xref && xref_get_active(hxref)) { xref_set_active(hxref, 0); - game_xref_update(hxref, oel->x, oel->y); + if (on != -1) + game_xref_update(hxref, oel->x, oel->y); } hxref = NULL; } @@ -1558,6 +1559,8 @@ void mouse_reset(int hl) { if (hl) game_highlight(-1, -1, 0); + else + game_highlight(-1, -1, -1); disable_use(); motion_mode = 0; old_xref = old_el = NULL;