diff options
author | Keith Dahlby <dahlbyk@gmail.com> | 2011-10-02 09:37:57 +0400 |
---|---|---|
committer | Emeric Fermas <emeric.fermas@gmail.com> | 2011-10-02 21:06:40 +0400 |
commit | ea0cdd852b6e6c4e9504cc455e0b01e6cf22d33f (patch) | |
tree | 99e45eadbd299c09265d4f90222fc841c00ca078 /LibGit2Sharp/BranchCollection.cs | |
parent | 7a622ced5b15225d8b42cf84f67699f95a549bfe (diff) |
Remove uses of ReferenceCollection.Resolve<T>() for non-Reference T
Diffstat (limited to 'LibGit2Sharp/BranchCollection.cs')
-rw-r--r-- | LibGit2Sharp/BranchCollection.cs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/LibGit2Sharp/BranchCollection.cs b/LibGit2Sharp/BranchCollection.cs index 54e1cd58..756d2f6b 100644 --- a/LibGit2Sharp/BranchCollection.cs +++ b/LibGit2Sharp/BranchCollection.cs @@ -28,7 +28,13 @@ namespace LibGit2Sharp /// </summary> public Branch this[string name] { - get { return repo.Refs.Resolve<Branch>(NormalizeToCanonicalName(name)); } + get + { + Ensure.ArgumentNotNullOrEmptyString(name, "name"); + var canonicalName = NormalizeToCanonicalName(name); + var reference = repo.Refs.Resolve<Reference>(canonicalName); + return reference == null ? null : new Branch(repo, reference, canonicalName); + } } #region IEnumerable<Branch> Members |