diff options
| author | Carlos Martín Nieto <[email protected]> | 2013-03-08 16:03:49 +0100 |
|---|---|---|
| committer | Carlos Martín Nieto <[email protected]> | 2013-03-08 16:03:49 +0100 |
| commit | 62a16395b17460887747602a4184372a0c9a6d6f (patch) | |
| tree | 372d9bd2553d0b84366d74e3eb9232f649b534d0 /git.go | |
| parent | b57c792bf35630ba4f73388be28966ebac404432 (diff) | |
Oid: make sure not to dereference a NULL git_oid
Some calls like Reference.Target() can return NULL if the reference is
symbolic. Make sure newOidFromC() can handle these situations.
Diffstat (limited to 'git.go')
| -rw-r--r-- | git.go | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -26,6 +26,10 @@ type Oid struct { } func newOidFromC(coid *C.git_oid) *Oid { + if coid == nil { + return nil + } + oid := new(Oid) copy(oid.bytes[0:20], C.GoBytes(unsafe.Pointer(coid), 20)) return oid |
