mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-12-23 12:45:38 +00:00
ava: Fix exit dialog while guest is running. (#5207)
* ava: Fix exit dialog while guest is running. There is currently an issue while a game runs, the content dialog creation method check if `IsGameRunning` is true to show the popup. But the condition here is wrong (`window` is null) so it throw a NullException silently in `Dispatcher.UIThread`. This is now fixed by using the right casting. * improve condition * Fix spacing
This commit is contained in:
parent
96ea4e8c8e
commit
c545c59851
|
@ -318,7 +318,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||
|
||||
Window parent = GetMainWindow();
|
||||
|
||||
if (parent is { IsActive: true } and MainWindow window && window.ViewModel.IsGameRunning)
|
||||
if (parent != null && parent.IsActive && (parent as MainWindow).ViewModel.IsGameRunning)
|
||||
{
|
||||
contentDialogOverlayWindow = new()
|
||||
{
|
||||
|
|
|
@ -519,14 +519,14 @@ namespace Ryujinx.Ava.UI.Windows
|
|||
private void ConfirmExit()
|
||||
{
|
||||
Dispatcher.UIThread.InvokeAsync(async () =>
|
||||
{
|
||||
ViewModel.IsClosing = await ContentDialogHelper.CreateExitDialog();
|
||||
{
|
||||
ViewModel.IsClosing = await ContentDialogHelper.CreateExitDialog();
|
||||
|
||||
if (ViewModel.IsClosing)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
});
|
||||
if (ViewModel.IsClosing)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public async void LoadApplications()
|
||||
|
|
Loading…
Reference in a new issue