diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2023-04-17 10:35:00 +0200 |
|---|---|---|
| committer | Jeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com> | 2023-04-18 14:05:19 +0200 |
| commit | 54682cfc8b4079aab588df5187d1ed806bf29c5f (patch) | |
| tree | 06545ea8348cac24bc6920cf90df1f59bde73c64 /exports/exports.go | |
| parent | 75a677f58f81802a84dd48a824272ddb606e68bb (diff) | |
Exports: Do not crash on invalid wrapped errors
Diffstat (limited to 'exports/exports.go')
| -rw-r--r-- | exports/exports.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/exports/exports.go b/exports/exports.go index a11c0fa..c09e980 100644 --- a/exports/exports.go +++ b/exports/exports.go @@ -44,8 +44,8 @@ import ( "unsafe" "github.com/eduvpn/eduvpn-common/internal/log" - "github.com/eduvpn/eduvpn-common/internal/server" "github.com/eduvpn/eduvpn-common/internal/oauth" + "github.com/eduvpn/eduvpn-common/internal/server" "github.com/go-errors/errors" "github.com/eduvpn/eduvpn-common/client" @@ -197,6 +197,11 @@ func getError(err error) *C.error { C.malloc(C.size_t(unsafe.Sizeof(C.error{}))), ) if err1, ok := err.(*errors.Error); ok { + if err1 == nil { + errorStruct.traceback = C.CString("N/A") + errorStruct.cause = C.CString("unknown error") + return errorStruct + } errorStruct.traceback = C.CString(err1.ErrorStack()) if err1.Err == nil { errorStruct.cause = C.CString(err1.Error()) |
