diff options
author | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2010-10-30 16:31:55 +0000 |
---|---|---|
committer | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2010-10-30 16:31:55 +0000 |
commit | a21aa6d989f53777f4652cc73954fd3d23fc0cdf (patch) | |
tree | 32e063a9100b3fac6487794664abe51ab616e04e /navit/vehicle.c | |
parent | d09f8de7a7cf38477ac94a6bf8fb56c57ae9888b (diff) | |
download | navit-a21aa6d989f53777f4652cc73954fd3d23fc0cdf.tar.gz |
Fix:Core:Avoid crash when switching layouts, fixes #685
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@3631 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/vehicle.c')
-rw-r--r-- | navit/vehicle.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/navit/vehicle.c b/navit/vehicle.c index 54d890b2c..a0d694185 100644 --- a/navit/vehicle.c +++ b/navit/vehicle.c @@ -297,7 +297,7 @@ vehicle_set_cursor(struct vehicle *this_, struct cursor *cursor) this_->animate_timer=event_add_timeout(cursor->interval, 1, this_->animate_callback); } - if (cursor && this_->gra) { + if (cursor && this_->gra && this_->cursor) { this_->cursor_pnt.x+=(this_->cursor->w - cursor->w)/2; this_->cursor_pnt.y+=(this_->cursor->h - cursor->h)/2; graphics_overlay_resize(this_->gra, &this_->cursor_pnt, cursor->w, cursor->h, 65535, 0); @@ -307,8 +307,13 @@ vehicle_set_cursor(struct vehicle *this_, struct cursor *cursor) if (cursor) { sc.x=cursor->w/2; sc.y=cursor->h/2; - } else + if (!this_->cursor && this_->gra) + graphics_overlay_disable(this_->gra, 0); + } else { sc.x=sc.y=0; + if (this_->cursor && this_->gra) + graphics_overlay_disable(this_->gra, 1); + } transform_set_screen_center(this_->trans, &sc); this_->cursor=cursor; |