From a86927b9463d15893d45c11af912b70383c4ee2d Mon Sep 17 00:00:00 2001 From: Markku Luukkainen Date: Tue, 26 May 2009 14:41:14 +0200 Subject: Fixed crash when building menu while softkeystack is empty --- src/gui/widgets/qmenu_symbian.cpp | 27 ++++++++++++++------------- 1 file 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(w); QSoftKeyStack* softKeyStack = mainWindow->softKeyStack(); - const QSoftkeySet& softKeyTop = softKeyStack->top(); - - int index=0; - bool found=false; - while( indexrole(); - 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( indexrole(); + 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; -- cgit v0.12