IsBranchExist: return false if provided name is empty (#8485)
IsBranchExist: return false if provided name is empty (#8485)

* IsBranchExist: return false if provided name is empty

* Ensure that the reference returned is actually of a valid type

go-gitea/gitea,vdbt/gitea,lafriks/gitea,vCaesar/gitea,typeless/gitea,cez81/gitea,sapk-fork/gitea,lafriks/gitea,vCaesar/gitea,sapk-fork/gitea,cez81/gitea,cez81/gitea,typeless/gitea,typeless/gitea,go-gitea/gitea,sapk-fork/gitea,sapk-fork/gitea,vdbt/gitea,go-gitea/gitea,lafriks/gitea,typeless/gitea