Skip to content

Commit

Permalink
Fix crash in Editor::drawOneSpriteUnclippedRect() (issue 361)
Browse files Browse the repository at this point in the history
We've to catch std::bad_alloc exceptions.
  • Loading branch information
dacap committed Mar 12, 2014
1 parent 2a70e75 commit eb7016b
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/app/ui/editor/editor.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit eb7016b

Please sign in to comment.