fix a bug of avatar not record to user (RealmSwift is a bad boy)

This commit is contained in:
nixzhu
2015-06-03 15:59:00 +08:00
parent cf2f02d17c
commit cb04abf6b9
+2 -2
View File
@@ -286,8 +286,8 @@ class AvatarCache {
}
// realm user线访 "Realm accessed from incorrect thread"
if let user = userWithUserID(userID, inRealm: realm) {
if user.avatar == nil, let avatar = avatar {
if let avatar = avatar {
if let user = userWithUserID(userID, inRealm: realm) {
realm.write {
user.avatar = avatar
}