kiplatform: check for null window handle in IsWindowActive().

This commit is contained in:
Tomasz Wlostowski 2021-04-27 00:22:03 +02:00
parent 524ca442f3
commit dc70df6036
2 changed files with 8 additions and 0 deletions

View File

@ -49,6 +49,9 @@ void KIPLATFORM::UI::ForceFocus( wxWindow* aWindow )
bool KIPLATFORM::UI::IsWindowActive( wxWindow* aWindow ) bool KIPLATFORM::UI::IsWindowActive( wxWindow* aWindow )
{ {
if( !aWindow )
return false;
GtkWindow* window = GTK_WINDOW( aWindow->GetHandle() ); GtkWindow* window = GTK_WINDOW( aWindow->GetHandle() );
if( window ) if( window )

View File

@ -75,6 +75,11 @@ void KIPLATFORM::UI::ForceFocus( wxWindow* aWindow )
bool KIPLATFORM::UI::IsWindowActive( wxWindow* aWindow ) bool KIPLATFORM::UI::IsWindowActive( wxWindow* aWindow )
{ {
if(! aWindow )
{
return false;
}
return ( aWindow->GetHWND() == GetForegroundWindow() ); return ( aWindow->GetHWND() == GetForegroundWindow() );
} }