fix issue with MessagePresenter potentially crashing

This commit is contained in:
Philipp Crocoll
2025-04-08 12:20:01 +02:00
parent 8b4314c394
commit 90f04b76f4

View File

@@ -78,7 +78,15 @@ namespace keepass2android.Utils
if (!queuedMessages.Any())
{
new Handler().PostDelayed(() => { ShowNextSnackbar(); }, (long)waitDuration.TotalMilliseconds);
if (Looper.MainLooper != null)
{
new Handler(Looper.MainLooper).PostDelayed(ShowNextSnackbar,
(long)waitDuration.TotalMilliseconds);
}
else
{
Kp2aLog.Log("Currently cannot show message");
}
}
queuedMessages.Add(message);