From b493fa3af3192692123f82d37475ebe1a4f36b08 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Wed, 30 Sep 2020 17:34:50 -0400 Subject: [PATCH] Add missing returns in system channels handlers (flutter/engine#21523) The Windows and GLFW embeddings both had cases of missing returns after calling `Error` on a method channel result object, leading to incorrect double-calls on the result if the error paths were ever hit. --- engine/src/flutter/shell/platform/glfw/text_input_plugin.cc | 1 + engine/src/flutter/shell/platform/windows/cursor_handler.cc | 1 + 2 files changed, 2 insertions(+) diff --git a/engine/src/flutter/shell/platform/glfw/text_input_plugin.cc b/engine/src/flutter/shell/platform/glfw/text_input_plugin.cc index 496b9e0abc..205ebdbdfb 100644 --- a/engine/src/flutter/shell/platform/glfw/text_input_plugin.cc +++ b/engine/src/flutter/shell/platform/glfw/text_input_plugin.cc @@ -139,6 +139,7 @@ void TextInputPlugin::HandleMethodCall( if (client_config.IsNull()) { result->Error(kBadArgumentError, "Could not set client, missing arguments."); + return; } client_id_ = client_id_json.GetInt(); input_action_ = ""; diff --git a/engine/src/flutter/shell/platform/windows/cursor_handler.cc b/engine/src/flutter/shell/platform/windows/cursor_handler.cc index c740b4a1ee..68060a08aa 100644 --- a/engine/src/flutter/shell/platform/windows/cursor_handler.cc +++ b/engine/src/flutter/shell/platform/windows/cursor_handler.cc @@ -40,6 +40,7 @@ void CursorHandler::HandleMethodCall( if (kind_iter == arguments.end()) { result->Error("Argument error", "Missing argument while trying to activate system cursor"); + return; } const auto& kind = std::get(kind_iter->second); delegate_->UpdateFlutterCursor(kind);