Catch nil error instances #25

Merged
carlosmn merged 1 commits from error-nil into master 2013-06-13 12:14:31 -05:00
1 changed files with 4 additions and 0 deletions

4
git.go
View File

@ -10,6 +10,7 @@ import (
"bytes"
"unsafe"
"strings"
"fmt"
)
const (
@ -107,6 +108,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)}
}