Merge pull request #25 from carlosmn/error-nil

Catch nil error instances
This commit is contained in:
Vicent Martí 2013-06-13 10:14:31 -07:00
commit 09424744a1
1 changed files with 4 additions and 0 deletions

4
git.go
View File

@ -11,6 +11,7 @@ import (
"errors"
"unsafe"
"strings"
"fmt"
)
const (
@ -132,6 +133,9 @@ func (e GitError) Error() string{
func LastError() error {
err := C.giterr_last()
if err == nil {
return &GitError{"No message", 0}
}
return &GitError{C.GoString(err.message), int(err.klass)}
}