diff options
author | Markku Luukkainen <markku.luukkainen@digia.com> | 2009-05-26 12:41:14 (GMT) |
---|---|---|
committer | Markku Luukkainen <markku.luukkainen@digia.com> | 2009-05-26 12:41:14 (GMT) |
commit | a86927b9463d15893d45c11af912b70383c4ee2d (patch) | |
tree | 9837823a10baa4bd7cfa80f189cf7f7e940ea94c | |
parent | ba552dae4daab3db8596e20f8491393e4479e7b0 (diff) | |
download | Qt-a86927b9463d15893d45c11af912b70383c4ee2d.zip Qt-a86927b9463d15893d45c11af912b70383c4ee2d.tar.gz Qt-a86927b9463d15893d45c11af912b70383c4ee2d.tar.bz2 |
Fixed crash when building menu while softkeystack is empty
-rw-r--r-- | src/gui/widgets/qmenu_symbian.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/gui/widgets/qmenu_symbian.cpp b/src/gui/widgets/qmenu_symbian.cpp index 1cff1bf..491c78e 100644 --- a/src/gui/widgets/qmenu_symbian.cpp +++ b/src/gui/widgets/qmenu_symbian.cpp @@ -185,20 +185,21 @@ static void rebuildMenu() QWidget *w = qApp->activeWindow(); QMainWindow *mainWindow = qobject_cast<QMainWindow*>(w); QSoftKeyStack* softKeyStack = mainWindow->softKeyStack(); - const QSoftkeySet& softKeyTop = softKeyStack->top(); - - int index=0; - bool found=false; - while( index<softKeyTop.count() && !found) { - QSoftKeyAction* softAction = softKeyTop.at(index); - QSoftKeyAction::StandardRole role = softAction->role(); - if(softAction->role() == QSoftKeyAction::ContextMenu) { - widgetWithContextMenu = softAction->parentWidget(); - found=true; - } - index++; + if (!softKeyStack->isEmpty()) { + const QSoftkeySet& softKeyTop = softKeyStack->top(); + int index=0; + bool found=false; + while( index<softKeyTop.count() && !found) { + QSoftKeyAction* softAction = softKeyTop.at(index); + QSoftKeyAction::StandardRole role = softAction->role(); + if(softAction->role() == QSoftKeyAction::ContextMenu) { + widgetWithContextMenu = softAction->parentWidget(); + found=true; + } + index++; + } } - + if (w) { mb = menubars()->value(w); qt_symbian_menu_static_cmd_id = QT_FIRST_MENU_ITEM; |