summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPrasanth Ullattil <prasanth.ullattil@nokia.com>2010-07-30 11:00:34 (GMT)
committerPrasanth Ullattil <prasanth.ullattil@nokia.com>2010-07-30 11:31:56 (GMT)
commitfb47a99e1d0020e8dcc4cc4f9c188ccd2fd5ee3e (patch)
tree2631beb95c089e0a0e3d4470382c91a16a1cd21a
parent288f3dae3e66221ab94090c7e3f59b6101f66941 (diff)
downloadQt-fb47a99e1d0020e8dcc4cc4f9c188ccd2fd5ee3e.zip
Qt-fb47a99e1d0020e8dcc4cc4f9c188ccd2fd5ee3e.tar.gz
Qt-fb47a99e1d0020e8dcc4cc4f9c188ccd2fd5ee3e.tar.bz2
QFileDialog crashes when empty selectedFilter is set on Carbon.
We were making the wrong assumption that the selectedFilter string will be valid always, when calling functions like getSaveFileName(). Task-number: QTBUG-12461 Reviewed-by: Denis
-rw-r--r--src/gui/dialogs/qfiledialog_mac.mm8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/gui/dialogs/qfiledialog_mac.mm b/src/gui/dialogs/qfiledialog_mac.mm
index f1afaa9..64fc0ee 100644
--- a/src/gui/dialogs/qfiledialog_mac.mm
+++ b/src/gui/dialogs/qfiledialog_mac.mm
@@ -782,9 +782,11 @@ void QFileDialogPrivate::qt_mac_filedialog_event_proc(const NavEventCallbackMess
const QtMacFilterName &fn = fileDialogPrivate->filterInfo.filters.at(
fileDialogPrivate->filterInfo.currentSelection);
QStringList reg = fn.regexp.split(QLatin1String(";"), QString::SkipEmptyParts);
- QString r = reg.first();
- r = r.right(r.length()-1); // Strip the *
- base += r; //"." + QString::number(s->menuType);
+ if (reg.count()) {
+ QString r = reg.first();
+ r = r.right(r.length()-1); // Strip the *
+ base += r; //"." + QString::number(s->menuType);
+ }
NavDialogSetSaveFileName(p->context, QCFString::toCFStringRef(base));
}
#ifdef DEBUG_FILEDIALOG_FILTERS