Bug 588646: 'Default' in personas menu does not reset persona
authorJose E. Bolanos <jose@appcoast.com>
Thu, 19 Aug 2010 09:50:39 -0600
changeset 1339 088b764662ae9090dbf254378909e947e48f2380
parent 1336 dea6fbf0875c0c96ed787d5010249c16023729b4
child 1344 2cbd2bcf31d9cbfa24d64e9bf4a4ae70229af9ce
push id860
push userjose@glaxstar.com
push dateThu, 19 Aug 2010 15:51:13 +0000
bugs588646
Bug 588646: 'Default' in personas menu does not reset persona
client/modules/service.js
--- a/client/modules/service.js
+++ b/client/modules/service.js
@@ -643,17 +643,17 @@ let PersonaService = {
    * Notifies the persona changes or uses the lightweight theme manager
    * functionality for this purpose (if available)
    * @param aPersona the persona to be set as current if the lightweight theme
    * manager is available
    */
   _notifyPersonaChanged : function(aPersona) {
     this._log.debug("_notifyPersonaChanged:\n" + Log4Moz.getStackTrace());
     if (LightweightThemeManager) {
-      if (aPersona.custom && LightweightThemeManager.setLocalTheme)
+      if (aPersona && aPersona.custom && LightweightThemeManager.setLocalTheme)
         LightweightThemeManager.setLocalTheme(aPersona);
       else
         LightweightThemeManager.currentTheme = aPersona;
     }
     else
       Observers.notify("personas:persona:changed");
   },
 
@@ -723,17 +723,18 @@ let PersonaService = {
       this.currentPersona = JSON.parse(previousPersona);
       this._revertRecent();
       this.selected = "current";
 
       if (LightweightThemeManager) {
         // forget the lightweight theme too
         LightweightThemeManager.forgetUsedTheme(undonePersonaId);
 
-        if (this.currentPersona.custom && LightweightThemeManager.setLocalTheme)
+        if (this.currentPersona && this.currentPersona.custom &&
+            LightweightThemeManager.setLocalTheme)
           LightweightThemeManager.setLocalTheme(this.currentPersona);
         else
           LightweightThemeManager.currentTheme = this.currentPersona;
       }
       else
         this.resetPersona();
     }
   },