handle if lastEvent is null
This commit is contained in:
parent
cdcd462ea5
commit
21a2ec5b2f
|
@ -184,16 +184,17 @@ class ChatListItem extends StatelessWidget {
|
||||||
softWrap: false,
|
softWrap: false,
|
||||||
)
|
)
|
||||||
: Text(
|
: Text(
|
||||||
room.lastEvent.getLocalizedBody(
|
room.lastEvent?.getLocalizedBody(
|
||||||
L10n.of(context),
|
L10n.of(context),
|
||||||
withSenderNamePrefix: !room.isDirectChat,
|
withSenderNamePrefix: !room.isDirectChat,
|
||||||
hideReply: true,
|
hideReply: true,
|
||||||
),
|
) ??
|
||||||
|
'',
|
||||||
softWrap: false,
|
softWrap: false,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.fade,
|
overflow: TextOverflow.fade,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
decoration: room.lastEvent.redacted
|
decoration: room.lastEvent?.redacted == true
|
||||||
? TextDecoration.lineThrough
|
? TextDecoration.lineThrough
|
||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
|
|
|
@ -384,10 +384,11 @@ class _ChatListState extends State<ChatList> {
|
||||||
var rooms = List<Room>.from(
|
var rooms = List<Room>.from(
|
||||||
Matrix.of(context).client.rooms);
|
Matrix.of(context).client.rooms);
|
||||||
rooms.removeWhere((Room room) =>
|
rooms.removeWhere((Room room) =>
|
||||||
searchMode &&
|
room.lastEvent == null ||
|
||||||
!room.displayname.toLowerCase().contains(
|
(searchMode &&
|
||||||
searchController.text.toLowerCase() ??
|
!room.displayname.toLowerCase().contains(
|
||||||
''));
|
searchController.text.toLowerCase() ??
|
||||||
|
'')));
|
||||||
if (rooms.isEmpty &&
|
if (rooms.isEmpty &&
|
||||||
(!searchMode ||
|
(!searchMode ||
|
||||||
publicRoomsResponse == null)) {
|
publicRoomsResponse == null)) {
|
||||||
|
|
Loading…
Reference in a new issue