From 402036b523cbfc40a06e0104380714eeedd6fb0c Mon Sep 17 00:00:00 2001 From: touyu Date: Fri, 4 May 2018 12:13:19 +0900 Subject: [PATCH] Fix to crash when url is empty --- .../ViewCell/CreateGroupChannelUserListTableViewCell.swift | 4 ++-- .../ViewCell/SelectedUserListCollectionViewCell.swift | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sample-swift/SendBird-iOS/GroupChannel/ViewCell/CreateGroupChannelUserListTableViewCell.swift b/sample-swift/SendBird-iOS/GroupChannel/ViewCell/CreateGroupChannelUserListTableViewCell.swift index 4767c41..d65a32c 100644 --- a/sample-swift/SendBird-iOS/GroupChannel/ViewCell/CreateGroupChannelUserListTableViewCell.swift +++ b/sample-swift/SendBird-iOS/GroupChannel/ViewCell/CreateGroupChannelUserListTableViewCell.swift @@ -28,8 +28,8 @@ class CreateGroupChannelUserListTableViewCell: UITableViewCell { func setModel(aUser: SBDUser) { self.user = aUser - if self.user.profileUrl != nil { - self.profileImageView.af_setImage(withURL: URL(string: self.user.profileUrl!)!, placeholderImage:UIImage(named: "img_profile")) + if let profileUrl = self.user.profileUrl, !profileUrl.isEmpty { + self.profileImageView.af_setImage(withURL: URL(string: profileUrl)!, placeholderImage:UIImage(named: "img_profile")) } else { self.profileImageView.image = UIImage(named: "img_profile") diff --git a/sample-swift/SendBird-iOS/GroupChannel/ViewCell/SelectedUserListCollectionViewCell.swift b/sample-swift/SendBird-iOS/GroupChannel/ViewCell/SelectedUserListCollectionViewCell.swift index d50c9e8..95eceae 100644 --- a/sample-swift/SendBird-iOS/GroupChannel/ViewCell/SelectedUserListCollectionViewCell.swift +++ b/sample-swift/SendBird-iOS/GroupChannel/ViewCell/SelectedUserListCollectionViewCell.swift @@ -27,8 +27,8 @@ class SelectedUserListCollectionViewCell: UICollectionViewCell { func setModel(aUser: SBDUser) { self.user = aUser - if self.user.profileUrl != nil { - self.profileImageView.af_setImage(withURL: URL(string: self.user.profileUrl!)!, placeholderImage:UIImage(named: "img_profile")) + if let profileUrl = self.user.profileUrl, !profileUrl.isEmpty { + self.profileImageView.af_setImage(withURL: URL(string: profileUrl)!, placeholderImage:UIImage(named: "img_profile")) } else { self.profileImageView.image = UIImage(named: "img_profile")