From 8d207e7a74b674b3a8425c83b3fb5e5da298426f Mon Sep 17 00:00:00 2001 From: tombam Date: Mon, 7 Oct 2024 10:39:12 +0200 Subject: [PATCH] fix NRE when showing the Prompt win non-async call --- .../Platforms/Android/Builders/PromptBuilder.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Acr.UserDialogs/Platforms/Android/Builders/PromptBuilder.cs b/src/Acr.UserDialogs/Platforms/Android/Builders/PromptBuilder.cs index 89a1c2cf..78d0827d 100644 --- a/src/Acr.UserDialogs/Platforms/Android/Builders/PromptBuilder.cs +++ b/src/Acr.UserDialogs/Platforms/Android/Builders/PromptBuilder.cs @@ -55,13 +55,13 @@ public class PromptBuilder : IAlertDialogBuilder .SetTitle(config.Title) //.SetView(txt) .SetPositiveButton(config.OkText, (s, a) => - config.OnAction(new PromptResult(true, txt.Text)) // DO NOT TRIM RESULT + config.OnAction?.Invoke(new PromptResult(true, txt.Text)) // DO NOT TRIM RESULT ); if (config.IsCancellable) { builder.SetNegativeButton(config.CancelText, (s, a) => - config.OnAction(new PromptResult(false, txt.Text)) // DO NOT TRIM RESULT + config.OnAction?.Invoke(new PromptResult(false, txt.Text)) // DO NOT TRIM RESULT ); } var dialog = builder.Create(); @@ -118,13 +118,13 @@ public Dialog Build(AppCompatActivity activity, PromptConfig config) .SetTitle(config.Title) //.SetView(txt) .SetPositiveButton(config.OkText, (s, a) => - config.OnAction(new PromptResult(true, txt.Text)) // DO NOT TRIM RESULT + config.OnAction?.Invoke(new PromptResult(true, txt.Text)) // DO NOT TRIM RESULT ); if (config.IsCancellable) { builder.SetNegativeButton(config.CancelText, (s, a) => - config.OnAction(new PromptResult(false, txt.Text)) // DO NOT TRIM RESULT + config.OnAction?.Invoke(new PromptResult(false, txt.Text)) // DO NOT TRIM RESULT ); } var dialog = builder.Create();