summaryrefslogtreecommitdiff
path: root/git.go
diff options
context:
space:
mode:
authorVicent Martí <[email protected]>2013-06-13 10:14:31 -0700
committerVicent Martí <[email protected]>2013-06-13 10:14:31 -0700
commit09424744a1ced15cb28bfa86e772405302148105 (patch)
treef3adfce4616d1ab21be3cc7f5619b96c602da0f6 /git.go
parent7823b142665d079a04e05ec0500e28145eeeb165 (diff)
parentd824ea415d050f5b41ce7eb680b137de653c843e (diff)
Merge pull request #25 from carlosmn/error-nil
Catch nil error instances
Diffstat (limited to 'git.go')
-rw-r--r--git.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/git.go b/git.go
index f5c69fd..d8cacc4 100644
--- a/git.go
+++ b/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)}
}