From: johanengelen Date: Mon, 2 Jun 2008 20:22:58 +0000 (+0000) Subject: check if item is LPEItem before casting!!! fixes bug 236788 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=eba069b7ad5846bcf40247fdb7056e06f5e6d7d5;p=inkscape.git check if item is LPEItem before casting!!! fixes bug 236788 --- diff --git a/src/shape-editor.cpp b/src/shape-editor.cpp index 1d60671aa..49d8a2a14 100644 --- a/src/shape-editor.cpp +++ b/src/shape-editor.cpp @@ -190,15 +190,23 @@ void ShapeEditor::set_item(SPItem *item) { this->grab_node = -1; if (item) { - SPLPEItem *lpeitem = SP_LPE_ITEM(item); - if (!sp_lpe_item_get_current_lpe(lpeitem) || // if returns NULL, the whole expression evaluates to true and C++ will not call the otherwise crashing 2 functions below - !sp_lpe_item_get_current_lpe(lpeitem)->isVisible() || - !sp_lpe_item_get_current_lpe(lpeitem)->providesKnotholder()) { - // only create nodepath if the item either doesn't have an LPE - // or the LPE is invisible or it doesn't provide a knotholder itself + if (SP_IS_LPE_ITEM(item)) { + SPLPEItem *lpeitem = SP_LPE_ITEM(item); + if ( !sp_lpe_item_get_current_lpe(lpeitem) || // if returns NULL, the whole expression evaluates to true and C++ will not call the otherwise crashing 2 functions below + !sp_lpe_item_get_current_lpe(lpeitem)->isVisible() || + !sp_lpe_item_get_current_lpe(lpeitem)->providesKnotholder() ) + // only create nodepath if the item either doesn't have an LPE + // or the LPE is invisible or it doesn't provide a knotholder itself + { + this->nodepath = + sp_nodepath_new(desktop, item, (prefs_get_int_attribute("tools.nodes", "show_handles", 1) != 0)); + } + } else { + // only create nodepath if the item either doesn't have an LPE: no fear the item cannot have an LPE this->nodepath = sp_nodepath_new(desktop, item, (prefs_get_int_attribute("tools.nodes", "show_handles", 1) != 0)); } + if (this->nodepath) { this->nodepath->shape_editor = this; }