Skip to content

Commit

Permalink
Returns nil in Go/NewWindow when C.webview_create returns NULL (webvi…
Browse files Browse the repository at this point in the history
  • Loading branch information
cgostuff authored Aug 16, 2022
1 parent 25e7f41 commit be92026
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions webview.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 139,14 @@ func New(debug bool) WebView { return NewWindow(debug, nil) }
// a pointer to the native window handle. If it's non-null - then child WebView is
// embedded into the given parent window. Otherwise a new window is created.
// Depending on the platform, a GtkWindow, NSWindow or HWND pointer can be passed
// here.
// here. Returns nil on failure. Creation can fail for various reasons such as when
// required runtime dependencies are missing or when window creation fails.
func NewWindow(debug bool, window unsafe.Pointer) WebView {
w := &webview{}
w.w = C.webview_create(boolToInt(debug), window)
return w
res := C.webview_create(boolToInt(debug), window)
if res == nil {
return nil
}
return &webview{w: res}
}

func (w *webview) Destroy() {
Expand Down

0 comments on commit be92026

Please sign in to comment.