Fix panic when no routes are defined

Fixes #23.

We need to check that a tree node exists before continuing.