moscajs / aedes-persistence-level

LevelDB persistence for Aedes
MIT License
5 stars 7 forks source link

removeSubscriptions error #2

Closed marvinroger closed 8 years ago

marvinroger commented 8 years ago

Line 164, if resubs is empty, you're affecting it null. Line 206, you're considering subs is always an array, which is not the case as it can be null.

Basically, a TypeError: Cannot read property 'map' of null error appears with an empty database.

mcollina commented 8 years ago

of course! Would you mind to send a quick pr? maybe we can even add a unit test about this case to https://github.com/mcollina/aedes-persistence/blob/master/abstract.js

marvinroger commented 8 years ago

I would just remove the condition that puts sub to null, it seems useless to other parts of the code. Regarding the unit test, I'll let you implement it as I am not familiar enough with aedes ;)