diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2008-06-02 20:22:58 +0000 |
|---|---|---|
| committer | johanengelen <johanengelen@users.sourceforge.net> | 2008-06-02 20:22:58 +0000 |
| commit | 28d72dc639e8d1423870a02b6f6fec1bf8b9f979 (patch) | |
| tree | 8238e7a890246f023fe9547b1825351d39b2822b /src/shape-editor.cpp | |
| parent | fix crash, report warnings instead. trying to find real cause for this (crash... (diff) | |
| download | inkscape-28d72dc639e8d1423870a02b6f6fec1bf8b9f979.tar.gz inkscape-28d72dc639e8d1423870a02b6f6fec1bf8b9f979.zip | |
check if item is LPEItem before casting!!! fixes bug 236788
(bzr r5793)
Diffstat (limited to 'src/shape-editor.cpp')
| -rw-r--r-- | src/shape-editor.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
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; } |
