DEV: Make interface route/controller more resilient to missing values

approved

#1

DEV: Make interface route/controller more resilient to missing values

diff --git a/app/assets/javascripts/discourse/controllers/preferences/interface.js.es6 b/app/assets/javascripts/discourse/controllers/preferences/interface.js.es6
index e01c86c..8eec21b 100644
--- a/app/assets/javascripts/discourse/controllers/preferences/interface.js.es6
+++ b/app/assets/javascripts/discourse/controllers/preferences/interface.js.es6
@@ -75,7 +75,7 @@ export default Ember.Controller.extend(PreferencesTabController, {
 
   @computed("model.user_option.theme_ids", "themeId")
   showThemeSetDefault(userOptionThemes, selectedTheme) {
-    return userOptionThemes[0] !== selectedTheme;
+    return !userOptionThemes || userOptionThemes[0] !== selectedTheme;
   },
 
   @computed("model.user_option.text_size", "textSize")
diff --git a/app/assets/javascripts/discourse/routes/preferences-interface.js.es6 b/app/assets/javascripts/discourse/routes/preferences-interface.js.es6
index ae5a103..34976bb 100644
--- a/app/assets/javascripts/discourse/routes/preferences-interface.js.es6
+++ b/app/assets/javascripts/discourse/routes/preferences-interface.js.es6
@@ -10,6 +10,7 @@ export default RestrictedUserRoute.extend({
       textSize: user.get("currentTextSize"),
       themeId: currentThemeId(),
       makeThemeDefault:
+        !user.get("user_option.theme_ids") ||
         currentThemeId() === user.get("user_option.theme_ids")[0],
       makeTextSizeDefault:
         user.get("currentTextSize") === user.get("user_option.text_size")

GitHub sha: 60fa4fe6


Approved #2