From 5bac646cee80f1699d5b9dd9727dc007cd6bf89e Mon Sep 17 00:00:00 2001 From: dooglus Date: Thu, 30 Aug 2007 22:43:22 +0000 Subject: [PATCH] Prevent a crash when clicking in the workarea after adding a PasteCanvas but not defining its canvas parameter. git-svn-id: http://svn.voria.com/code@566 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-core/trunk/src/synfig/layer_pastecanvas.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/synfig-core/trunk/src/synfig/layer_pastecanvas.cpp b/synfig-core/trunk/src/synfig/layer_pastecanvas.cpp index d76318f..a769b33 100644 --- a/synfig-core/trunk/src/synfig/layer_pastecanvas.cpp +++ b/synfig-core/trunk/src/synfig/layer_pastecanvas.cpp @@ -244,18 +244,19 @@ Layer_PasteCanvas::hit_check(synfig::Context context, const synfig::Point &pos)c { if(depth==MAX_DEPTH)return 0;depth_counter counter(depth); - Point target_pos=(pos-canvas->rend_desc().get_focus()-origin)/exp(zoom)+canvas->rend_desc().get_focus(); + if (canvas) { + Point target_pos=(pos-canvas->rend_desc().get_focus()-origin)/exp(zoom)+canvas->rend_desc().get_focus(); - if(canvas && get_amount() && canvas->get_context().get_color(target_pos).get_a()>=0.25) - { - if(!children_lock) + if(canvas && get_amount() && canvas->get_context().get_color(target_pos).get_a()>=0.25) { - return canvas->get_context().hit_check(target_pos); + if(!children_lock) + { + return canvas->get_context().hit_check(target_pos); + } + return const_cast(this); } - return const_cast(this); } - else - return context.hit_check(pos); + return context.hit_check(pos); } Color -- 2.7.4