fix router when self.history or self.history.length is undefoned
Merge pull request #12 from telepharm/router-fix

fix router when self.history or self.history.length is undefoned