From 30324c8ec01405821258dc729d7c47eb539f056b Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Sat, 2 Feb 2019 17:46:15 -0800 Subject: [PATCH] Make sure that feed.editedName is never "". Treat it as nil. --- Frameworks/Account/Feed.swift | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Frameworks/Account/Feed.swift b/Frameworks/Account/Feed.swift index f7c42fe0d..36c1e6cac 100644 --- a/Frameworks/Account/Feed.swift +++ b/Frameworks/Account/Feed.swift @@ -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() } }