Merge pull request #25 from carlosmn/error-nil
Catch nil error instances
This commit is contained in:
commit
09424744a1
4
git.go
4
git.go
|
@ -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)}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue