Make sure that feed.editedName is never "". Treat it as nil.
This commit is contained in:
parent
3f57cdf4f7
commit
30324c8ec0
|
@ -96,12 +96,21 @@ public final class Feed: DisplayNameProvider, Renamable, UnreadCountProvider, Ha
|
|||
}
|
||||
|
||||
public var editedName: String? {
|
||||
// Don’t let editedName == ""
|
||||
get {
|
||||
return settingsTable.string(for: Key.editedName)
|
||||
guard let s = settingsTable.string(for: Key.editedName), !s.isEmpty else {
|
||||
return nil
|
||||
}
|
||||
return s
|
||||
}
|
||||
set {
|
||||
if newValue != editedName {
|
||||
settingsTable.setString(newValue, for: Key.editedName)
|
||||
if let valueToSet = newValue, !valueToSet.isEmpty {
|
||||
settingsTable.setString(valueToSet, for: Key.editedName)
|
||||
}
|
||||
else {
|
||||
settingsTable.setString(nil, for: Key.editedName)
|
||||
}
|
||||
postDisplayNameDidChangeNotification()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue