mirror of
https://github.com/QL-Win/QuickLook.git
synced 2026-03-19 01:01:49 +08:00
Fix null check logic for screen detection
Co-authored-by: emako <24737061+emako@users.noreply.github.com>
This commit is contained in:
@@ -105,10 +105,14 @@ public partial class ViewerWindow
|
||||
}
|
||||
|
||||
// Get the screen bounds where the window is currently located
|
||||
var screen = WinForms.Screen.FromHandle(new WindowInteropHelper(this).Handle) ?? WinForms.Screen.PrimaryScreen;
|
||||
// Screen.FromHandle never returns null, but PrimaryScreen can be null in edge cases
|
||||
var screen = WinForms.Screen.FromHandle(new WindowInteropHelper(this).Handle);
|
||||
if (screen == null)
|
||||
screen = WinForms.Screen.PrimaryScreen;
|
||||
|
||||
if (screen == null)
|
||||
{
|
||||
// Fallback to default screen bounds if no screen is available
|
||||
// Edge case: no screen available (e.g., no monitors connected)
|
||||
Debug.WriteLine("Unable to get screen bounds for fullscreen mode");
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user