We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 02a4566 commit 9350e82Copy full SHA for 9350e82
Flow.Launcher.Plugin/SharedCommands/ShellCommand.cs
@@ -54,12 +54,12 @@ private static unsafe string GetWindowTitle(HWND hwnd)
54
{
55
var capacity = PInvoke.GetWindowTextLength(hwnd) + 1;
56
int length;
57
- Span<char> buffer = stackalloc char[capacity];
+ Span<char> buffer = capacity < 1024 ? stackalloc char[capacity] : new char[capacity];
58
fixed (char* pBuffer = buffer)
59
60
// If the window has no title bar or text, if the title bar is empty,
61
// or if the window or control handle is invalid, the return value is zero.
62
- length = PInvoke.GetWindowText(hwnd, (PWSTR)pBuffer, capacity);
+ length = PInvoke.GetWindowText(hwnd, pBuffer, capacity);
63
}
64
65
return buffer[..length].ToString();
0 commit comments