X-Git-Url: https://git.toastfreeware.priv.at/toast/confclerk.git/blobdiff_plain/280f29b1e52958d36d17fe2a8f2e4686e68a01a8..5b7fa79bd7a4f4b468a82947cc1659e866084c73:/src/mvc/conferencemodel.cpp diff --git a/src/mvc/conferencemodel.cpp b/src/mvc/conferencemodel.cpp index c03761c..604d98f 100644 --- a/src/mvc/conferencemodel.cpp +++ b/src/mvc/conferencemodel.cpp @@ -39,19 +39,21 @@ QVariant ConferenceModel::data(const QModelIndex& index, int role) const if (role != Qt::DisplayRole) { return QVariant(); } - return conferences[index.row()].title(); +} - try { - const Conference& c = conferenceFromIndex(index); - return c.title(); - } catch (OrmNoObjectException&) { - return QVariant(); +const Conference& ConferenceModel::conferenceFromIndex(const QModelIndex& index) const +{ + if (index.parent().isValid() + or index.column() != 0 + or index.row() >= conferences.size()) + { + throw OrmNoObjectException(); } - + return conferences[index.row()]; } -const Conference& ConferenceModel::conferenceFromIndex(const QModelIndex& index) const +Conference& ConferenceModel::conferenceFromIndex(const QModelIndex& index) { if (index.parent().isValid() or index.column() != 0