Skip to content

Commit 9fd520d

Browse files
committed
[dotnet] quit fails after not successful new session
If new session creation fails a Quit() method is called which calls Dispose and then Quit command, unfortunately in this case session is still not created and it throws null reference exception and this hides the actual exception
1 parent 785914e commit 9fd520d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

dotnet/src/webdriver/WebDriver.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,10 @@ protected virtual void Dispose(bool disposing)
703703
{
704704
try
705705
{
706-
this.Execute(DriverCommand.Quit, null);
706+
if (this.sessionId is not null)
707+
{
708+
this.Execute(DriverCommand.Quit, null);
709+
}
707710
}
708711
catch (NotImplementedException)
709712
{

0 commit comments

Comments
 (0)