Make sure that feed.editedName is never "". Treat it as nil.

This commit is contained in:
Brent Simmons 2019-02-02 17:46:15 -08:00
parent 3f57cdf4f7
commit 30324c8ec0
1 changed files with 11 additions and 2 deletions

View File

@ -96,12 +96,21 @@ public final class Feed: DisplayNameProvider, Renamable, UnreadCountProvider, Ha
}
public var editedName: String? {
// Dont 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()
}
}