Fix a crash issue if there is not master branch.

Repo step:
1. Create a project.
2. git push http://xxxxx.git  master:test
3. Browse files from web.
4. Crash.

Root cause:
If the branch is not master, in RepositoryBrowser::TryGetBrunch(),
_repository.Head.Target will be null. _repository.Head.Target.Hash
will throw a null reference exception.

Fix:
if _repository.Head.Target is null, use the first branch as the default
branch.
Fix a crash if user browses an empty repository.

Repo step:
1. Create a project.
2. Browse the project files via web.
3. Crash.

Root cause:
A null reference exception raised in Repository::Resolve(). reversion is
null for this case.