diff --git a/shell/platform/windows/platform_handler_win32.cc b/shell/platform/windows/platform_handler_win32.cc index dac80a0e5a9b5..93d391a8f8f94 100644 --- a/shell/platform/windows/platform_handler_win32.cc +++ b/shell/platform/windows/platform_handler_win32.cc @@ -241,12 +241,12 @@ void PlatformHandlerWin32::GetHasStrings( bool hasStrings; int open_result = clipboard_->Open(std::get(*view_->GetRenderTarget())); if (open_result != kErrorSuccess) { - rapidjson::Document error_code; - error_code.SetInt(open_result); // Swallow errors of type ERROR_ACCESS_DENIED. These happen when the app is // not in the foreground and GetHasStrings is irrelevant. // See https://github.com/flutter/flutter/issues/95817. - if (error_code != kAccessDeniedErrorCode) { + if (open_result != kAccessDeniedErrorCode) { + rapidjson::Document error_code; + error_code.SetInt(open_result); result->Error(kClipboardError, "Unable to open clipboard", error_code); return; }