~ps-jenkins/unity-scopes-shell/ubuntu-vivid-proposed

« back to all changes in this revision

Viewing changes to src/Unity/department.cpp

  • Committer: CI bot
  • Author(s): Pete Woods
  • Date: 2014-11-28 08:52:01 UTC
  • mfrom: (165.1.9 today-scope-crash)
  • Revision ID: ps-jenkins@lists.canonical.com-20141128085201-agykz8pxf5k9n60e
Fix crash exposed by today scope Fixes: #1396526
Approved by: Pawel Stolowski

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
#include <unity/scopes/OptionSelectorFilter.h>
23
23
 
 
24
#include <QDebug>
 
25
 
24
26
namespace scopes_ng
25
27
{
26
28
 
108
110
 
109
111
QVariant Department::data(const QModelIndex& index, int role) const
110
112
{
 
113
    int row = index.row();
 
114
    if (row >= m_subdepartments.size())
 
115
    {
 
116
        qWarning() << "Department::data - invalid index" << row << "size"
 
117
                << m_subdepartments.size();
 
118
        return QVariant();
 
119
    }
 
120
 
111
121
    SubdepartmentData* data = m_subdepartments[index.row()].data();
112
122
    switch (role) {
113
123
        case RoleNavigationId: return data->id;