fixed topic hierarchy

If top level topic is empty (all subscribers were unsubscribered),
messages[topic] is empty Array. So function messageHasSubscribers will
return false, because topic found and have 0 subscribers, so here will
not be check for lower topic levels.

fixes: codio/client#1788