Backport bugfix in hosts form when location is nil

This commit fixes a bug that has been fixed in
acfbc45886c4d81a2a3ca5af433a6124a0a7191a

Without that commit, a 500 error is generated when there is no location
available for the user when creating a new host.