Don't try to show a task tile if there is none for the current index

This commit is contained in:
kolaente 2020-01-16 22:08:26 +01:00
parent 78ddbecd19
commit 5f7d59c7ea
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B

View File

@ -77,9 +77,9 @@ class _ListPageState extends State<ListPage> {
// in _loadTasksForPage()? // in _loadTasksForPage()?
_loadTasksForPage(_currentPage); _loadTasksForPage(_currentPage);
} }
return TaskTile( return index < _tasks.length ? TaskTile(
task: _tasks[index], task: _tasks[index],
); ): null;
}) })
: Center(child: Text('This list is empty.')), : Center(child: Text('This list is empty.')),
onRefresh: _loadList, onRefresh: _loadList,