summaryrefslogtreecommitdiff
path: root/push.go
diff options
context:
space:
mode:
authorJesse Ezell <[email protected]>2014-02-28 10:58:53 -0800
committerJesse Ezell <[email protected]>2014-02-28 10:58:53 -0800
commit9fb7a746e0103ceff2fd8eb9845e782711a87535 (patch)
tree006aeed81400762baeb18fe1ef64d324abaa4ac5 /push.go
parent374e2112dfc298fa5ecb0805624d75b3500cc345 (diff)
fix handling of msg to treat empty str as nil
Diffstat (limited to 'push.go')
-rw-r--r--push.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/push.go b/push.go
index 0694fe3..d1742e3 100644
--- a/push.go
+++ b/push.go
@@ -79,8 +79,13 @@ func (p *Push) UpdateTips(sig *Signature, msg string) error {
defer C.free(unsafe.Pointer(csig))
}
- cmsg := C.CString(msg)
- defer C.free(unsafe.Pointer(cmsg))
+ var cmsg *C.char
+ if msg == "" {
+ cmsg = nil
+ } else {
+ cmsg = C.CString(msg)
+ defer C.free(unsafe.Pointer(cmsg))
+ }
runtime.LockOSThread()
defer runtime.UnlockOSThread()