     /// Scroll to the bottom of message collection view
     final public func scrollToBottom(animated animated: Bool) {
         guard collectionView?.numberOfSections() != 0 else { return }
+        guard collectionView?.numberOfItemsInSection(0) != 0 else { return }
         
         let lastIndexPath: NSIndexPath = NSIndexPath(forItem: collectionView!.numberOfItemsInSection(0) - 1, inSection: 0)
         scrollTo(indexPath: lastIndexPath, animated: animated)

// MARK: Class method
public extension DUMessagesViewController {
    static var nib: UINib { return UINib.init(nibName: self.nameOfClass, bundle: NSBundle(identifier: Constants.bundleIdentifier)) }
}




    }
    
    
    // FIXME: for current controller can not be released due to unfound retain cycle, we remove notification in viewDidDisappear for temporary
    override public func viewDidDisappear(animated: Bool) {
        super.viewDidDisappear(animated)
        clearForNotification()
    }
    deinit {
        collectionView?.delegate = nil
        collectionView?.dataSource = nil
