From 7ee129b21a3bb0c28a77780f1d379d01a247b507 Mon Sep 17 00:00:00 2001 From: Anton Blanchard Date: Fri, 22 Feb 2013 18:29:44 -0500 Subject: [PATCH] Fixes segfault in Pcbnew module editor when clicking delete tool where there is no object. --- pcbnew/modedit_onclick.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pcbnew/modedit_onclick.cpp b/pcbnew/modedit_onclick.cpp index be0b16edd9..c9e0018b6d 100644 --- a/pcbnew/modedit_onclick.cpp +++ b/pcbnew/modedit_onclick.cpp @@ -120,9 +120,10 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) case ID_MODEDIT_DELETE_TOOL: if( ! no_item_edited ) // Item in edit, cannot delete it break; + item = ModeditLocateAndDisplay(); - if( item->Type() != PCB_MODULE_T ) // Cannot delete the module itself + if( item && item->Type() != PCB_MODULE_T ) // Cannot delete the module itself { SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT ); RemoveStruct( item );