Skip to content

Commit

Permalink
Fix empty callback error
Browse files Browse the repository at this point in the history
  • Loading branch information
rzhao271 committed Oct 15, 2021
1 parent 32d2427 commit c730e0d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions shell/browser/api/electron_api_app.cc
Expand Up @@ -526,7 +526,7 @@ bool NotificationCallbackWrapper(
const ProcessSingleton::NotificationAckCallback& ack_callback) {
// Make sure the callback is called after app gets ready.
if (Browser::Get()->is_ready()) {
callback.Run(cmd, cwd, additional_data, ack_callback);
callback.Run(cmd, cwd, std::move(additional_data), ack_callback);
} else {
scoped_refptr<base::SingleThreadTaskRunner> task_runner(
base::ThreadTaskRunnerHandle::Get());
Expand Down Expand Up @@ -1084,9 +1084,14 @@ void App::OnFirstInstanceAck(
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate);
v8::Local<v8::Value> data_to_send;
base::Value data_to_send;
if (first_instance_data) {
data_to_send = DeserializeV8Value(isolate, *first_instance_data);
// Don't send back the local directly, because it might be empty
v8::Local<v8::Value> data_local;
data_local = DeserializeV8Value(isolate, *first_instance_data);
if (!data_local.IsEmpty()) {
gin::ConvertFromV8(isolate, data_local, &data_to_send);
}
}
Emit("first-instance-ack", data_to_send);
}
Expand Down

0 comments on commit c730e0d

Please sign in to comment.