Fix crash

This commit is contained in:
Stefan Markovic 2024-02-23 10:38:24 +01:00
parent 48811ecb4d
commit e9c2301b56
2 changed files with 2 additions and 2 deletions

View File

@ -98,7 +98,7 @@ namespace FileLocksmith::Interop
{
HANDLE hStdin = INVALID_HANDLE_VALUE;
if (!pipeName->Empty)
if (pipeName->Length > 0)
{
std::wstring pipe = from_system_string(pipeName);

View File

@ -80,7 +80,7 @@ namespace PowerToys.FileLocksmithUI.ViewModels
public MainViewModel()
{
var args = Environment.GetCommandLineArgs();
var pipeName = args.Where(s => s.Contains("\\\\.\\pipe\\")).FirstOrDefault();
string pipeName = args.Where(s => s.Contains("\\\\.\\pipe\\")).FirstOrDefault() ?? string.Empty;
paths = NativeMethods.ReadPathsFromPipe(pipeName);
Logger.LogInfo($"Starting FileLocksmith with {paths.Length} files selected.");