From 157ee6f29cd255bba847f1cc4b2364da23c4c8e7 Mon Sep 17 00:00:00 2001 From: Keith Dahlby Date: Sat, 14 Apr 2012 11:09:33 -0500 Subject: Throw when accessing Index of a bare repository --- LibGit2Sharp/Repository.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'LibGit2Sharp') diff --git a/LibGit2Sharp/Repository.cs b/LibGit2Sharp/Repository.cs index 2593bcb3..680d9670 100644 --- a/LibGit2Sharp/Repository.cs +++ b/LibGit2Sharp/Repository.cs @@ -101,7 +101,15 @@ namespace LibGit2Sharp /// public Index Index { - get { return index; } + get + { + if (index == null) + { + throw new LibGit2Exception("Index is not available in a bare repository."); + } + + return index; + } } /// -- cgit v1.2.3