Browse Source

Fix #487

Emptying the resources array when the resource is null
rlanvin 9 years ago
parent
commit
8d495d30fe
2 changed files with 8 additions and 0 deletions
  1. 7 0
      converse.js
  2. 1 0
      docs/CHANGES.md

+ 7 - 0
converse.js

@@ -4192,6 +4192,13 @@
                         this.save({'resources': resources});
                     }
                 }
+                else {
+                    // if there is no resource (resource is null), it probably
+                    // means that the user is now completely offline. To make sure
+                    // that there isn't any "ghost" resources left, we empty the array
+                    this.save({'resources': []});
+                    return 0;
+                }
                 return resources.length;
             },
 

+ 1 - 0
docs/CHANGES.md

@@ -15,6 +15,7 @@
 - #547 By default the `offline` state is no longer choosable.
   See [include_offline_state](https://conversejs.org/docs/html/configuration.html#include_offline_state) for details. [jcbrand]
 - A chatroom invite might come from someone not in your roster list. [ben]
+- #487 Empty the resources array when the resource is null [rlanvin]
 
 ## 0.10.0 (2015-11-05)