diff --git a/v3/pkg/application/messageprocessor_call.go b/v3/pkg/application/messageprocessor_call.go index ddbddd37..51dcc942 100644 --- a/v3/pkg/application/messageprocessor_call.go +++ b/v3/pkg/application/messageprocessor_call.go @@ -49,11 +49,14 @@ func (m *MessageProcessor) processCallMethod(method string, rw http.ResponseWrit m.callErrorCallback(window, "Error calling method: %s", callID, err) return } - // convert result to json - jsonResult, err := json.Marshal(result) - if err != nil { - m.callErrorCallback(window, "Error converting result to json: %s", callID, err) - return + var jsonResult = []byte("{}") + if result != nil { + // convert result to json + jsonResult, err = json.Marshal(result) + if err != nil { + m.callErrorCallback(window, "Error converting result to json: %s", callID, err) + return + } } m.callCallback(window, callID, string(jsonResult), true) }() diff --git a/v3/pkg/application/webview_window_windows.go b/v3/pkg/application/webview_window_windows.go index cdc412fd..11bd9842 100644 --- a/v3/pkg/application/webview_window_windows.go +++ b/v3/pkg/application/webview_window_windows.go @@ -90,7 +90,9 @@ func (w *windowsWebviewWindow) setMaxSize(width, height int) { } func (w *windowsWebviewWindow) execJS(js string) { - w.chromium.Eval(js) + invokeSync(func() { + w.chromium.Eval(js) + }) } func (w *windowsWebviewWindow) setBackgroundColour(color RGBA) {