Fix null pointer dereference in status.ByIndex #628
|
@ -6,6 +6,7 @@ package git
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"runtime"
|
"runtime"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
@ -87,7 +88,7 @@ func (statusList *StatusList) ByIndex(index int) (StatusEntry, error) {
|
||||||
}
|
}
|
||||||
ptr := C.git_status_byindex(statusList.ptr, C.size_t(index))
|
ptr := C.git_status_byindex(statusList.ptr, C.size_t(index))
|
||||||
if ptr == nil {
|
if ptr == nil {
|
||||||
return StatusEntry{}, fmt.Errorf("Index out of Bounds")
|
return StatusEntry{}, errors.New("index out of Bounds")
|
||||||
}
|
}
|
||||||
entry := statusEntryFromC(ptr)
|
entry := statusEntryFromC(ptr)
|
||||||
runtime.KeepAlive(statusList)
|
runtime.KeepAlive(statusList)
|
||||||
|
|
Loading…
Reference in New Issue