From fd4d2092f96531604f6f61cb5e98fb77903e95e1 Mon Sep 17 00:00:00 2001 From: Neil Wang <weili.wang@highsoft.ltd> Date: Thu, 9 Mar 2023 07:53:12 +0000 Subject: [PATCH] =?UTF-8?q?bugfix:=20#777=20=E5=B8=96=E5=AD=90=E7=9C=8B?= =?UTF-8?q?=E4=B8=8D=E5=88=B0=E8=AF=84=E8=AE=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/modules/issues/details/models/note/note_entity.dart | 2 +- lib/modules/issues/details/models/note/note_repository.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/modules/issues/details/models/note/note_entity.dart b/lib/modules/issues/details/models/note/note_entity.dart index 98a837720..01c5c67d5 100644 --- a/lib/modules/issues/details/models/note/note_entity.dart +++ b/lib/modules/issues/details/models/note/note_entity.dart @@ -22,7 +22,7 @@ class NoteEntity { static NoteEntity restore(Map<String, dynamic> map) { return NoteEntity._internal(map['id'], map['note_id'], map['noteable_id'], map['noteable_iid'], map['discussion_id'], map['system'] == 0 ? false : true, map['body'], map['assignee_id'], map['created_at'], map['version'], map['internal'], - assigneeEntity: AssigneeEntity.restore(map['author'])); + assigneeEntity: map['author'] != null ? AssigneeEntity.restore(map['author']) : null); } static NoteEntity create(Map<String, dynamic> map, String discussionId, int version) { diff --git a/lib/modules/issues/details/models/note/note_repository.dart b/lib/modules/issues/details/models/note/note_repository.dart index 275f314f6..e4e43aadc 100644 --- a/lib/modules/issues/details/models/note/note_repository.dart +++ b/lib/modules/issues/details/models/note/note_repository.dart @@ -22,7 +22,7 @@ class NoteRepository { for (var item in list) { var assigneeEntityList = await AssigneeRepository.instance().queryById(item['assignee_id'] as int); Map<String, dynamic> newItem = Map.from(item); - newItem['author'] = assigneeEntityList.first.toMap(); + if (assigneeEntityList.isNotEmpty) newItem['author'] = assigneeEntityList.first.toMap(); newList.add(newItem); } return newList.map((e) => NoteEntity.restore(e)).toList(); -- GitLab