Fix crash in Editor::drawOneSpriteUnclippedRect() if a temporary surface cannot be created (fix #413)

This commit is contained in:
David Capello 2014-10-26 00:33:21 -03:00
parent fa1d9de578
commit 80073e65d1
2 changed files with 9 additions and 5 deletions

View File

@ -412,9 +412,11 @@ void Editor::drawOneSpriteUnclippedRect(ui::Graphics* g, const gfx::Rect& rc, in
}
she::Surface* tmp(she::instance()->createRgbaSurface(width, height));
convert_image_to_surface(rendered, m_sprite->getPalette(m_frame),
tmp, 0, 0, 0, 0, width, height);
g->blit(tmp, 0, 0, dest_x, dest_y, width, height);
if (tmp->nativeHandle()) {
convert_image_to_surface(rendered, m_sprite->getPalette(m_frame),
tmp, 0, 0, 0, 0, width, height);
g->blit(tmp, 0, 0, dest_x, dest_y, width, height);
}
tmp->dispose();
}
}

View File

@ -59,8 +59,10 @@ namespace she {
}
~Alleg4Surface() {
if (m_destroy & DestroyHandle)
destroy_bitmap(m_bmp);
if (m_destroy & DestroyHandle) {
if (m_bmp)
destroy_bitmap(m_bmp);
}
}
// Surface implementation