From 223efe74579f7ec945bd91894e488a0a16dcc632 Mon Sep 17 00:00:00 2001 From: Niels Date: Fri, 5 Nov 2010 16:43:32 +0100 Subject: [PATCH] do not crash if no city is selected --- searchwidget.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/searchwidget.cpp b/searchwidget.cpp index a43bb9c..9a55502 100644 --- a/searchwidget.cpp +++ b/searchwidget.cpp @@ -134,7 +134,10 @@ void SearchWidget::citySelected(QListWidgetItem *item) void SearchWidget::streetChanged(const QString &street) { if (m_loaded) { - m_addrLookup->SelectPlace(m_cityList->currentItem()->data(Qt::UserRole).toInt()); + QListWidgetItem *item = m_cityList->currentItem(); + if (item) { + m_addrLookup->SelectPlace(item->data(Qt::UserRole).toInt()); + } QStringList suggestions, inputSuggestions; bool found = m_addrLookup->GetStreetSuggestions(street, 20, &suggestions, &inputSuggestions); if (found) {