mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-04 03:40:45 +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 *url = [urlSchemeTask.request.URL.absoluteString UTF8String];
|
||||||
const char *method = [urlSchemeTask.request.HTTPMethod UTF8String];
|
const char *method = [urlSchemeTask.request.HTTPMethod UTF8String];
|
||||||
const char *headerJSON = "";
|
const char *headerJSON = "";
|
||||||
const void *body;
|
const void *body = nil;
|
||||||
int bodyLen;
|
int bodyLen = 0;
|
||||||
|
|
||||||
NSData *headers = [NSJSONSerialization dataWithJSONObject: urlSchemeTask.request.allHTTPHeaderFields options:0 error: nil];
|
NSData *headers = [NSJSONSerialization dataWithJSONObject: urlSchemeTask.request.allHTTPHeaderFields options:0 error: nil];
|
||||||
if (headers) {
|
if (headers) {
|
||||||
|
@ -396,7 +396,7 @@ func processMessage(message *C.char) {
|
|||||||
//export processURLRequest
|
//export processURLRequest
|
||||||
func processURLRequest(ctx unsafe.Pointer, url *C.char, method *C.char, headers *C.char, body unsafe.Pointer, bodyLen C.int) {
|
func processURLRequest(ctx unsafe.Pointer, url *C.char, method *C.char, headers *C.char, body unsafe.Pointer, bodyLen C.int) {
|
||||||
var goBody []byte
|
var goBody []byte
|
||||||
if bodyLen != 0 {
|
if body != nil && bodyLen != 0 {
|
||||||
goBody = C.GoBytes(body, bodyLen)
|
goBody = C.GoBytes(body, bodyLen)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user