From ab3491adeffbda3161f086da53dc69041ccbf629 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Tue, 29 May 2012 14:21:29 +0200 Subject: [PATCH] Fix crash when removing last converter (bug 8178) --- src/frontends/qt4/GuiPrefs.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/frontends/qt4/GuiPrefs.cpp b/src/frontends/qt4/GuiPrefs.cpp index 2302cc9fae..39f68412cd 100644 --- a/src/frontends/qt4/GuiPrefs.cpp +++ b/src/frontends/qt4/GuiPrefs.cpp @@ -1694,10 +1694,16 @@ void PrefConverters::updateButtons() bool const valid = !(converterED->text().isEmpty() || from.name() == to.name()); - int const cnr = convertersLW->currentItem()->type(); - Converter const & c = form_->converters().get(cnr); - string const old_command = c.command; - string const old_flag = c.flags; + string old_command; + string old_flag; + + if (convertersLW->count() > 0) { + int const cnr = convertersLW->currentItem()->type(); + Converter const & c = form_->converters().get(cnr); + old_command = c.command; + old_flag = c.flags; + } + string const new_command = fromqstr(converterED->text()); string const new_flag = fromqstr(converterFlagED->text()); -- 2.39.2