Fix issue when uninstalling applications

This prevents a call to a member function getPrimaryController() on a non-object in Route.class.php and allows uninstallation of applications again.
Merge pull request #1854 from max-m/patch-13

Fix issue when uninstalling applications