mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-21 07:20:46 +00:00
Fix crash in Editor::drawOneSpriteUnclippedRect() (issue 361)
We've to catch std::bad_alloc exceptions.
This commit is contained in:
parent
2a70e750cd
commit
eb7016bede
@ -28,6 +28,7 @@
|
||||
#include "app/commands/commands.h"
|
||||
#include "app/commands/params.h"
|
||||
#include "app/document_location.h"
|
||||
#include "app/console.h"
|
||||
#include "app/ini_file.h"
|
||||
#include "app/modules/gfx.h"
|
||||
#include "app/modules/gui.h"
|
||||
@ -385,9 +386,15 @@ void Editor::drawOneSpriteUnclippedRect(ui::Graphics* g, const gfx::Rect& rc, in
|
||||
RenderEngine renderEngine(m_document, m_sprite, m_layer, m_frame);
|
||||
|
||||
// Generate the rendered image
|
||||
base::UniquePtr<Image> rendered
|
||||
(renderEngine.renderSprite(source_x, source_y, width, height,
|
||||
m_frame, m_zoom, true));
|
||||
base::UniquePtr<Image> rendered(NULL);
|
||||
try {
|
||||
rendered.reset(renderEngine.renderSprite(
|
||||
source_x, source_y, width, height,
|
||||
m_frame, m_zoom, true));
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
Console::showException(e);
|
||||
}
|
||||
|
||||
if (rendered) {
|
||||
// Pre-render decorator.
|
||||
|
Loading…
x
Reference in New Issue
Block a user