Fix crash when trying to draw a unit with no image

This commit is contained in:
Celtic Minstrel 2016-07-18 02:39:12 -04:00
parent da30504945
commit 2d7d6a0dde

View file

@ -249,8 +249,8 @@ void unit_drawer::redraw_unit (const unit & u) const
if(draw_bars) {
const image::locator* orb_img = nullptr;
const surface unit_img = image::get_image(u.default_anim_image(), image::SCALED_TO_ZOOM);
const int xoff = (hex_size - unit_img->w)/2;
const int yoff = (hex_size - unit_img->h)/2;
const int xoff = unit_img.null() ? hex_size_by_2 : (hex_size - unit_img->w)/2;
const int yoff = unit_img.null() ? hex_size_by_2 : (hex_size - unit_img->h)/2;
/*static*/ const image::locator partmoved_orb(game_config::images::orb + "~RC(magenta>" +
preferences::partial_color() + ")" );
/*static*/ const image::locator moved_orb(game_config::images::orb + "~RC(magenta>" +