Fix getLastHop() to return null when hops.size() == 0

Fix getLastHop() to return null when hops.size() == 0 rather than throwing an exception.
Remove unnecessary call to getLastHop() in extend().