🐛 Fix bug render chat message on cannot find user

This commit is contained in:
LittleSheep 2024-11-20 00:13:36 +08:00
parent 6af695d74e
commit c7f059b6d7
2 changed files with 3 additions and 2 deletions

View File

@ -68,6 +68,7 @@ class SnAttachmentProvider {
.toList();
for (final item in out) {
if (item == null) continue;
if (item.isAnalyzed && item.isUploaded) {
_cache[item.rid] = item;
}

View File

@ -40,7 +40,7 @@ class ChatMessage extends StatelessWidget {
final ud = context.read<UserDirectoryProvider>();
final user = ud.getAccountFromCache(data.sender.accountId);
final isOwner = ua.isAuthorized && data.sender.accountId == ua.user!.id;
final isOwner = ua.isAuthorized && data.sender.accountId == ua.user?.id;
final dateFormatter = DateFormat('MM/dd HH:mm');
@ -109,7 +109,7 @@ class ChatMessage extends StatelessWidget {
Text(
(data.sender.nick?.isNotEmpty ?? false)
? data.sender.nick!
: user!.nick,
: user?.nick ?? 'unknown',
).bold(),
if (data.updatedAt != data.createdAt)
Text(