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:
parent
d9120181b7
commit
22d3f93b52
@ -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) {
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user