From 18802c24e363d7f4982af86a3e9be437cb8585b2 Mon Sep 17 00:00:00 2001 From: Mirko Nosenzo Date: Sun, 29 May 2016 15:27:48 +0200 Subject: [PATCH] Checkout Callbacks Payload Check in Callback Functions Checking payloads in callback functions --- checkout.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/checkout.go b/checkout.go index ba411ff..7377d51 100644 --- a/checkout.go +++ b/checkout.go @@ -96,6 +96,9 @@ func (opts *CheckoutOpts) toC() *C.git_checkout_options { //export checkoutNotifyCallback func checkoutNotifyCallback(why C.git_checkout_notify_t, cpath *C.char, cbaseline, ctarget, cworkdir, data unsafe.Pointer) int { + if data == nil { + return 0 + } path := C.GoString(cpath) var baseline, target, workdir DiffFile if cbaseline != nil { @@ -116,6 +119,9 @@ func checkoutNotifyCallback(why C.git_checkout_notify_t, cpath *C.char, cbaselin //export checkoutProgressCallback func checkoutProgressCallback(path *C.char, completed_steps, total_steps C.size_t, data unsafe.Pointer) int { + if data == nil { + return 0 + } opts := pointerHandles.Get(data).(CheckoutOpts) if opts.ProgressCallback == nil { return 0