segfault fix

This commit is contained in:
p.kosyh 2010-01-21 13:55:01 +00:00
parent aa8e6016d9
commit 40a24638a8

View file

@ -1534,7 +1534,7 @@ int game_highlight(int x, int y, int on)
static struct el *oel = NULL; static struct el *oel = NULL;
static xref_t hxref = NULL; static xref_t hxref = NULL;
xref_t xref = NULL; xref_t xref = NULL;
if (on) { if (on == 1) {
xref = look_xref(x, y, &elem); xref = look_xref(x, y, &elem);
if (xref && opt_hl && !xref_get_active(xref)) { if (xref && opt_hl && !xref_get_active(xref)) {
xref_set_active(xref, 1); xref_set_active(xref, 1);
@ -1545,7 +1545,8 @@ int game_highlight(int x, int y, int on)
if (hxref != xref && oel) { if (hxref != xref && oel) {
if (hxref != use_xref && xref_get_active(hxref)) { if (hxref != use_xref && xref_get_active(hxref)) {
xref_set_active(hxref, 0); 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; hxref = NULL;
} }
@ -1558,6 +1559,8 @@ void mouse_reset(int hl)
{ {
if (hl) if (hl)
game_highlight(-1, -1, 0); game_highlight(-1, -1, 0);
else
game_highlight(-1, -1, -1);
disable_use(); disable_use();
motion_mode = 0; motion_mode = 0;
old_xref = old_el = NULL; old_xref = old_el = NULL;