Skip to content

Commit

Permalink
Add argument check (#59634)
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximLipnin committed Sep 27, 2021
1 parent d698901 commit b7ac14b
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ private void CreateMutexCore(bool initiallyOwned, string? name, out bool created

private static OpenExistingResult OpenExistingWorker(string name, out Mutex? result)
{
if (name == null)
{
throw new ArgumentNullException(nameof(name));
}

if (name.Length == 0)
{
throw new ArgumentException(SR.Argument_EmptyName, nameof(name));
}

OpenExistingResult status = WaitSubsystem.OpenNamedMutex(name, out SafeWaitHandle? safeWaitHandle);
result = status == OpenExistingResult.Success ? new Mutex(safeWaitHandle!) : null;
return status;
Expand Down

0 comments on commit b7ac14b

Please sign in to comment.