Fix crash in notifications.

This commit is contained in:
Martin Rotter 2023-09-29 11:16:34 +02:00
parent fa211e3ba1
commit 8bb9e96a3b
9 changed files with 22 additions and 10 deletions

View File

@ -4,7 +4,7 @@ RSS Guard
[![Total downloads](https://img.shields.io/github/downloads/martinrotter/rssguard/total.svg?maxAge=360)](https://somsubhra.github.io/github-release-stats/?username=martinrotter&repository=rssguard&search=0)
[![Version](https://img.shields.io/github/release/martinrotter/rssguard.svg?maxAge=360)](https://raw.githubusercontent.com/martinrotter/rssguard/master/resources/text/CHANGELOG)
[![Packaging status](https://repology.org/badge/tiny-repos/rssguard.svg)](https://repology.org/project/rssguard/versions)
[![Documentation status](https://readthedocs.org/projects/rssguard/badge/?version=latest)](https://rssguard.readthedocs.io/en/latest/?badge=latest)
[![Documentation status](https://readthedocs.org/projects/rssguard/badge/?version=latest)](https://rssguard.readthedocs.io)
[![GitHub issues](https://img.shields.io/github/issues/martinrotter/rssguard.svg?maxAge=360)](https://github.com/martinrotter/rssguard/issues)
[![License](https://img.shields.io/github/license/martinrotter/rssguard.svg?maxAge=360000)](https://github.com/martinrotter/rssguard/blob/master/LICENSE.md)

View File

@ -1,3 +1,7 @@
.wy-nav-content {
max-width: none !important;
}
.wy-side-nav-search {
background-color: rgb(250, 166, 136) !important;
}

View File

@ -1,4 +0,0 @@
{% extends "!layout.html" %}
{% block extrahead %}
<link href="{{ pathto("_static/style.css", True) }}" rel="stylesheet" type="text/css">
{% endblock %}

View File

@ -35,6 +35,7 @@ html_theme_options = {
myst_enable_extensions = [
"amsmath",
"attrs_block",
"attrs_inline",
"colon_fence",
"deflist",
@ -50,4 +51,8 @@ myst_enable_extensions = [
"tasklist",
]
html_css_files = [
'style.css',
]
myst_heading_anchors = 4

View File

@ -4,7 +4,7 @@ Official place to download RSS Guard is at [Github Releases page](https://github
RSS Guard is also available in [repositories of many Linux distributions](https://repology.org/project/rssguard/versions), and via [Flathub](https://flathub.org/about).
The are two different flavors:
The are two different [flavors](#features/browseradblock):
* [Regular](https://flathub.org/apps/details/io.github.martinrotter.rssguard): Includes an (almost) full-blown integrated web browser (built with `-DUSE_WEBENGINE=ON`).
* [Lite](https://flathub.org/apps/details/io.github.martinrotter.rssguardlite): Includes simpler, safer (and less memory hungry integrated web browser (built with `-DUSE_WEBENGINE=OFF`).

View File

@ -1,4 +1,4 @@
RSS Guards documentation!
RSS Guards Documentation!
=========================
.. toctree::

View File

@ -1,3 +1,3 @@
What is RSS Guard?
==================
RSS Guard is an [open-source](https://en.wikipedia.org/wiki/Open_source) cross-platform multi-protocol desktop feed reader. It is able to fetch feeds in RSS/RDF/ATOM/JSON formats and connect to multiple web-based feed readers. RSS Guard is developed on top of the [Qt library](http://qt-project.org).
RSS Guard is an [open-source](https://en.wikipedia.org/wiki/Open_source) [cross-platform](#supported-os) [multi-protocol](#supported-readers) desktop feed reader. It is able to fetch feeds in RSS/RDF/ATOM/JSON formats and connect to multiple web-based feed readers. RSS Guard is developed on top of the [Qt library](http://qt-project.org).

View File

@ -3,6 +3,7 @@
#include "core/articlelistnotificationmodel.h"
#include "definitions/definitions.h"
#include "exceptions/applicationexception.h"
ArticleListNotificationModel::ArticleListNotificationModel(QObject* parent)
: QAbstractListModel(parent), m_currentPage(-1) {}
@ -19,7 +20,13 @@ void ArticleListNotificationModel::setArticles(const QList<Message>& msgs) {
}
Message ArticleListNotificationModel::message(const QModelIndex& idx) const {
return m_articles.at((m_currentPage * NOTIFICATIONS_PAGE_SIZE) + idx.row());
int list_position = (m_currentPage * NOTIFICATIONS_PAGE_SIZE) + idx.row();
if (list_position < 0 || list_position >= m_articles.size()) {
throw ApplicationException(QSL("message cannot be loaded, wrong index"));
}
return m_articles.at(list_position);
}
void ArticleListNotificationModel::nextPage() {

View File

@ -113,6 +113,6 @@ Message ArticleListNotification::selectedMessage() const {
return m_model->message(m_ui.m_treeArticles->currentIndex());
}
else {
throw ApplicationException("message cannot be loaded, wrong index");
throw ApplicationException(QSL("message cannot be loaded, wrong index"));
}
}