Merge pull request #2852 from rcorre/fix-max-items

Fix web-history-max-items-crash.
This commit is contained in:
Florian Bruhin 2017-07-24 07:29:16 +02:00 committed by GitHub
commit df3ba278e9
2 changed files with 6 additions and 1 deletions

View File

@ -71,6 +71,10 @@ class HistoryCategory(QSqlQueryModel):
'ORDER BY last_atime DESC LIMIT :limit)',
])).run(limit=max_items).value()
if not min_atime:
# if there are no history items, min_atime may be '' (issue #2849)
return ''
return "AND last_atime >= {}".format(min_atime)
def set_pattern(self, pattern):

View File

@ -125,7 +125,8 @@ def test_set_pattern(pattern, before, after, model_validator, hist):
], [
('b', 'b', '2017-06-16'),
('c', 'c', '2017-05-16'),
])
]),
(1, [], []), # issue 2849 (crash with empty history)
])
def test_sorting(max_items, before, after, model_validator, hist, config_stub):
"""Validate the filtering and sorting results of set_pattern."""