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/TagCollection.cs | |
parent | 7a622ced5b15225d8b42cf84f67699f95a549bfe (diff) |
Remove uses of ReferenceCollection.Resolve<T>() for non-Reference T
Diffstat (limited to 'LibGit2Sharp/TagCollection.cs')
-rw-r--r-- | LibGit2Sharp/TagCollection.cs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/LibGit2Sharp/TagCollection.cs b/LibGit2Sharp/TagCollection.cs index 1ba74f2d..f866dc8e 100644 --- a/LibGit2Sharp/TagCollection.cs +++ b/LibGit2Sharp/TagCollection.cs @@ -29,7 +29,13 @@ namespace LibGit2Sharp /// </summary> public Tag this[string name] { - get { return repo.Refs.Resolve<Tag>(NormalizeToCanonicalName(name)); } + get + { + Ensure.ArgumentNotNullOrEmptyString(name, "name"); + var canonicalName = NormalizeToCanonicalName(name); + var reference = repo.Refs.Resolve<Reference>(canonicalName); + return reference == null ? null : new Tag(repo, reference, canonicalName); + } } #region IEnumerable<Tag> Members |