From 2ff140321274c757994d439ca8832dd5440971f9 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 27 May 2016 11:27:28 +0200 Subject: [PATCH] Gerbview: fix a crash when clicking on a gbr item not on active layer. --- gerbview/locate.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gerbview/locate.cpp b/gerbview/locate.cpp index e357b1e055..2fe475c17a 100644 --- a/gerbview/locate.cpp +++ b/gerbview/locate.cpp @@ -52,7 +52,7 @@ GERBER_DRAW_ITEM* GERBVIEW_FRAME::Locate( const wxPoint& aPosition, int aTypeloc GERBER_FILE_IMAGE* gerber = g_GERBER_List.GetGbrImage( layer ); // Search first on active layer - GERBER_DRAW_ITEM* gerb_item; + GERBER_DRAW_ITEM* gerb_item = NULL; if( gerber ) // A not used graphic layer can be selected. So gerber can be NULL { @@ -83,10 +83,13 @@ GERBER_DRAW_ITEM* GERBVIEW_FRAME::Locate( const wxPoint& aPosition, int aTypeloc break; } } + + if( found ) + break; } } - if( found ) + if( found && gerb_item ) { MSG_PANEL_ITEMS items; gerb_item->GetMsgPanelInfo( items );