diff --git a/engine/src/flutter/shell/platform/common/incoming_message_dispatcher.cc b/engine/src/flutter/shell/platform/common/incoming_message_dispatcher.cc index 07dd0b1900..5cc23d2481 100644 --- a/engine/src/flutter/shell/platform/common/incoming_message_dispatcher.cc +++ b/engine/src/flutter/shell/platform/common/incoming_message_dispatcher.cc @@ -19,14 +19,15 @@ void IncomingMessageDispatcher::HandleMessage( const std::function& input_unblock_cb) { std::string channel(message.channel); + auto callback_iterator = callbacks_.find(channel); // Find the handler for the channel; if there isn't one, report the failure. - if (callbacks_.find(channel) == callbacks_.end()) { + if (callback_iterator == callbacks_.end()) { FlutterDesktopMessengerSendResponse(messenger_, message.response_handle, nullptr, 0); return; } - auto& callback_info = callbacks_[channel]; - FlutterDesktopMessageCallback message_callback = callback_info.first; + auto& callback_info = callback_iterator->second; + const FlutterDesktopMessageCallback& message_callback = callback_info.first; // Process the call, handling input blocking if requested. bool block_input = input_blocking_channels_.count(channel) > 0;