summaryrefslogtreecommitdiff
path: root/status.go
diff options
context:
space:
mode:
Diffstat (limited to 'status.go')
-rw-r--r--status.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/status.go b/status.go
index e37a96d..3923e1a 100644
--- a/status.go
+++ b/status.go
@@ -6,6 +6,7 @@ package git
import "C"
import (
+ "errors"
"runtime"
"unsafe"
)
@@ -86,6 +87,9 @@ func (statusList *StatusList) ByIndex(index int) (StatusEntry, error) {
return StatusEntry{}, ErrInvalid
}
ptr := C.git_status_byindex(statusList.ptr, C.size_t(index))
+ if ptr == nil {
+ return StatusEntry{}, errors.New("index out of Bounds")
+ }
entry := statusEntryFromC(ptr)
runtime.KeepAlive(statusList)