File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
panels/notification/center Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -117,12 +117,18 @@ QVariantList AppNotifyItem::actions() const
117117void AppNotifyItem::updateActions ()
118118{
119119 QStringList actions = m_entity.actions ();
120- const auto defaultIndex = actions.indexOf (QLatin1String (" default" ));
121- if (defaultIndex >= 0 ) {
122- actions.remove (defaultIndex, 2 );
120+ if (actions.contains (QLatin1String (" default" ))) {
121+ actions.removeAll (QLatin1String (" default" ));
123122 m_defaultAction = QLatin1String (" default" );
124123 }
125124
125+ Q_ASSERT (actions.size () % 2 != 1 );
126+ if (actions.size () % 2 == 1 ) {
127+ qWarning (notifyLog) << " Actions must be an even number except for default, The notify appName:" << m_entity.appName ()
128+ << " , actions:" << m_entity.actions ();
129+ return ;
130+ }
131+
126132 QVariantList array;
127133 for (int i = 0 ; i < actions.size (); i += 2 ) {
128134 const auto id = actions[i];
You can’t perform that action at this time.
0 commit comments