From 0f5260e6003dfb6675b5d251ae97689ada211f37 Mon Sep 17 00:00:00 2001 From: James Crook Date: Mon, 12 Sep 2016 20:49:49 +0100 Subject: [PATCH] Bug 1512 - Extended Import: Crash dragging an importer when there are no rules --- src/prefs/ExtImportPrefs.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/prefs/ExtImportPrefs.cpp b/src/prefs/ExtImportPrefs.cpp index 1ce8b566e..3c53b910b 100644 --- a/src/prefs/ExtImportPrefs.cpp +++ b/src/prefs/ExtImportPrefs.cpp @@ -218,7 +218,9 @@ void ExtImportPrefs::SwapPluginRows (int row1, int row2) ImportPlugin *ip1, *ip2; auto &items = Importer::Get().GetImportItems(); - ExtImportItem *item = items[last_selected].get(); + ExtImportItem *item = NULL; + if( last_selected >= 0 ) + item = items[last_selected].get(); t = PluginList->GetItemText (row1); d = PluginList->GetItemData (row1); @@ -229,6 +231,8 @@ void ExtImportPrefs::SwapPluginRows (int row1, int row2) { PluginList->SetItemData (row1, PluginList->GetItemData (row2)); PluginList->SetItemData (row2, d); + if( !item ) + return; if (d == -1) { item->divider = row2; @@ -240,6 +244,8 @@ void ExtImportPrefs::SwapPluginRows (int row1, int row2) } else { + if( !item ) + return; ip1 = item->filter_objects[d]; ip2 = item->filter_objects[d2]; item->filter_objects[d] = ip2; @@ -332,6 +338,8 @@ void ExtImportPrefs::OnPluginBeginDrag(wxListEvent& WXUNUSED(event)) dragtext2->SetText(wxT("")); dragSource.SetData(*dragtext2); mDragFocus = PluginList; + if( mDragFocus == NULL ) + return; wxDragResult result = dragSource.DoDragDrop(wxDrag_DefaultMove); mDragFocus = NULL; switch (result)