Skip to content

Commit a100829

Browse files
authored
fix(auth, windows): fix a crash that could happen when using sendEmailVerification or sendPasswordResetEmail (#12946)
* fix(auth, windows): fix a crash that could happen when using sendEmailVerification or sendPasswordResetEmail * format
1 parent 747b0b6 commit a100829

File tree

2 files changed

+26
-9
lines changed

2 files changed

+26
-9
lines changed

packages/firebase_auth/firebase_auth/windows/messages.g.cpp

+20-8
Original file line numberDiff line numberDiff line change
@@ -2856,10 +2856,16 @@ void FirebaseAuthHostApi::SetUp(flutter::BinaryMessenger* binary_messenger,
28562856
const auto& email_arg =
28572857
std::get<std::string>(encodable_email_arg);
28582858
const auto& encodable_action_code_settings_arg = args.at(2);
2859-
const auto* action_code_settings_arg =
2860-
&(std::any_cast<const PigeonActionCodeSettings&>(
2861-
std::get<CustomEncodableValue>(
2862-
encodable_action_code_settings_arg)));
2859+
// IF CODE REGENERATED, PLEASE REINSERT THIS. IF ARG IS NULL, APP
2860+
// CRASHES
2861+
const PigeonActionCodeSettings* action_code_settings_arg =
2862+
nullptr;
2863+
if (!encodable_action_code_settings_arg.IsNull()) {
2864+
action_code_settings_arg =
2865+
&(std::any_cast<const PigeonActionCodeSettings&>(
2866+
std::get<CustomEncodableValue>(
2867+
encodable_action_code_settings_arg)));
2868+
}
28632869
api->SendPasswordResetEmail(
28642870
app_arg, email_arg, action_code_settings_arg,
28652871
[reply](std::optional<FlutterError>&& output) {
@@ -3744,10 +3750,16 @@ void FirebaseAuthUserHostApi::SetUp(flutter::BinaryMessenger* binary_messenger,
37443750
const auto& app_arg = std::any_cast<const AuthPigeonFirebaseApp&>(
37453751
std::get<CustomEncodableValue>(encodable_app_arg));
37463752
const auto& encodable_action_code_settings_arg = args.at(1);
3747-
const auto* action_code_settings_arg =
3748-
&(std::any_cast<const PigeonActionCodeSettings&>(
3749-
std::get<CustomEncodableValue>(
3750-
encodable_action_code_settings_arg)));
3753+
// IF CODE REGENERATED, PLEASE REINSERT THIS. IF ARG IS NULL, APP
3754+
// CRASHES
3755+
const PigeonActionCodeSettings* action_code_settings_arg =
3756+
nullptr;
3757+
if (!encodable_action_code_settings_arg.IsNull()) {
3758+
action_code_settings_arg =
3759+
&(std::any_cast<const PigeonActionCodeSettings&>(
3760+
std::get<CustomEncodableValue>(
3761+
encodable_action_code_settings_arg)));
3762+
}
37513763
api->SendEmailVerification(
37523764
app_arg, action_code_settings_arg,
37533765
[reply](std::optional<FlutterError>&& output) {

packages/firebase_core/firebase_core/example/windows/flutter/CMakeLists.txt

+6-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ include(${EPHEMERAL_DIR}/generated_config.cmake)
1010
# https://github.com/flutter/flutter/issues/57146.
1111
set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper")
1212

13+
# Set fallback configurations for older versions of the flutter tool.
14+
if (NOT DEFINED FLUTTER_TARGET_PLATFORM)
15+
set(FLUTTER_TARGET_PLATFORM "windows-x64")
16+
endif()
17+
1318
# === Flutter Library ===
1419
set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")
1520

@@ -92,7 +97,7 @@ add_custom_command(
9297
COMMAND ${CMAKE_COMMAND} -E env
9398
${FLUTTER_TOOL_ENVIRONMENT}
9499
"${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
95-
windows-x64 $<CONFIG>
100+
${FLUTTER_TARGET_PLATFORM} $<CONFIG>
96101
VERBATIM
97102
)
98103
add_custom_target(flutter_assemble DEPENDS

0 commit comments

Comments
 (0)