diff --git a/projects/ucap-webmessenger-ui-room/src/lib/components/list-item.component.ts b/projects/ucap-webmessenger-ui-room/src/lib/components/list-item.component.ts index 7a8c0f4f..232bafd4 100644 --- a/projects/ucap-webmessenger-ui-room/src/lib/components/list-item.component.ts +++ b/projects/ucap-webmessenger-ui-room/src/lib/components/list-item.component.ts @@ -89,11 +89,13 @@ export class ListItemComponent implements OnInit { this.defaultPath = 'assets/images/img_groupphoto_80.png'; break; case RoomType.Mytalk: - const me = this.roomUserInfo.filter( - v => v.seq === this.loginRes.userSeq - ); - if (!!me && me.length > 0) { - this.imagePath = me[0].profileImageFile; + if (!!this.roomUserInfo && !!this.loginRes) { + const me = this.roomUserInfo.filter( + v => v.seq === this.loginRes.userSeq + ); + if (!!me && me.length > 0) { + this.imagePath = me[0].profileImageFile; + } } break; case RoomType.Single: @@ -101,11 +103,13 @@ export class ListItemComponent implements OnInit { case RoomType.Allim: case RoomType.Allim_Elephant: case RoomType.Allim_TMS: - const others = this.roomUserInfo.filter( - v => v.seq !== this.loginRes.userSeq - ); - if (!!others && others.length > 0) { - this.imagePath = others[0].profileImageFile; + if (!!this.roomUserInfo && !!this.loginRes) { + const others = this.roomUserInfo.filter( + v => v.seq !== this.loginRes.userSeq + ); + if (!!others && others.length > 0) { + this.imagePath = others[0].profileImageFile; + } } break; } @@ -113,13 +117,15 @@ export class ListItemComponent implements OnInit { get _roomUserInfos() { if (this.roomInfo.roomType === RoomType.Single) { - return this.roomUserInfo.filter(roomUserInfo => { - return this.loginRes.userSeq !== roomUserInfo.seq; - }); + return this.roomUserInfo.filter( + roomUserInfo => + !!this.loginRes && this.loginRes.userSeq !== roomUserInfo.seq + ); } else { return this.roomUserInfo .filter(roomUserInfo => { return ( + !!this.loginRes && this.loginRes.userSeq !== roomUserInfo.seq && roomUserInfo.isJoinRoom );