summaryrefslogtreecommitdiffstats
path: root/libdimensionxx/canvas.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libdimensionxx/canvas.cpp')
-rw-r--r--libdimensionxx/canvas.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/libdimensionxx/canvas.cpp b/libdimensionxx/canvas.cpp
index 3ff9d32..6118730 100644
--- a/libdimensionxx/canvas.cpp
+++ b/libdimensionxx/canvas.cpp
@@ -24,7 +24,12 @@ namespace Dimension
{
// Allocate the canvas with dmnsn_new_canvas()
Canvas::Canvas(unsigned int width, unsigned int height)
- : m_canvas(new dmnsn_canvas*(dmnsn_new_canvas(width, height))) { }
+ : m_canvas(new dmnsn_canvas*(dmnsn_new_canvas(width, height)))
+ {
+ if (!dmnsn()) {
+ throw Dimension_Error("Couldn't allocate canvas.");
+ }
+ }
// Wrap an existing dmnsn_canvas*
Canvas::Canvas(dmnsn_canvas* canvas)