From 2ed3474ab8e52c98a87e390d5128d45d693a115d Mon Sep 17 00:00:00 2001 From: Máximo Cuadros Date: Mon, 22 Aug 2016 03:29:05 +0200 Subject: ForEach review and Commit.Tree err return --- cshared/commit_cshared.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'cshared/commit_cshared.go') diff --git a/cshared/commit_cshared.go b/cshared/commit_cshared.go index e73fb4a..8cb91aa 100644 --- a/cshared/commit_cshared.go +++ b/cshared/commit_cshared.go @@ -62,7 +62,11 @@ func c_Commit_Tree(c uint64) uint64 { return IH } commit := obj.(*git.Commit) - tree := commit.Tree() + tree, err := commit.Tree() + if err != nil { + return IH + } + tree_handle := RegisterObject(tree) return uint64(tree_handle) } @@ -156,14 +160,14 @@ func c_Commit_References(c uint64, path string) (*C.char, int, int, *C.char) { return nil, 0, ErrorCodeInternal, C.CString(err.Error()) } handles := make([]uint64, len(refs)) - for i, c := range(refs) { + for i, c := range refs { handles[i] = uint64(RegisterObject(c)) } size := 8 * len(handles) dest := C.malloc(C.size_t(size)) header := (*reflect.SliceHeader)(unsafe.Pointer(&handles)) header.Len *= 8 - copy((*[1<<30]byte)(dest)[:], *(*[]byte)(unsafe.Pointer(header))) + copy((*[1 << 30]byte)(dest)[:], *(*[]byte)(unsafe.Pointer(header))) return (*C.char)(dest), size / 8, ErrorCodeSuccess, nil } -- cgit