5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-03 03:09:17 +08:00

[v2, darwin] Initialize native variables on stack to prevent segfault (#1362)

This commit is contained in:
stffabi 2022-04-29 22:11:19 +02:00 committed by GitHub
parent d9120181b7
commit 22d3f93b52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -397,8 +397,8 @@
const char *url = [urlSchemeTask.request.URL.absoluteString UTF8String];
const char *method = [urlSchemeTask.request.HTTPMethod UTF8String];
const char *headerJSON = "";
const void *body;
int bodyLen;
const void *body = nil;
int bodyLen = 0;
NSData *headers = [NSJSONSerialization dataWithJSONObject: urlSchemeTask.request.allHTTPHeaderFields options:0 error: nil];
if (headers) {

View File

@ -396,7 +396,7 @@ func processMessage(message *C.char) {
//export processURLRequest
func processURLRequest(ctx unsafe.Pointer, url *C.char, method *C.char, headers *C.char, body unsafe.Pointer, bodyLen C.int) {
var goBody []byte
if bodyLen != 0 {
if body != nil && bodyLen != 0 {
goBody = C.GoBytes(body, bodyLen)
}