Merge pull request #2852 from rcorre/fix-max-items
Fix web-history-max-items-crash.
This commit is contained in:
commit
df3ba278e9
@ -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):
|
||||
|
@ -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."""
|
||||
|
Loading…
Reference in New Issue
Block a user