Skip to content

Commit 8c68153

Browse files
committed
fix: ensure session_id is set only if session is absent
1 parent de385e2 commit 8c68153

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/ferrum/context.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ def add_target(params:, session_id: nil)
6161
new_target = Target.new(@client, session_id, params)
6262
# `put_if_absent` returns nil if added a new value or existing if there was one already
6363
target = @targets.put_if_absent(new_target.id, new_target) || new_target
64-
# on first iteration session_id may be null, then if session is present here we must set it to the target
65-
target.session_id = session_id if session_id
64+
# on first iteration session_id may be nil, then if session is present here we must set it to the target
65+
target.session_id = session_id if session_id && target.session_id.nil?
6666
@default_target ||= target
6767

6868
new_pending = Concurrent::IVar.new

0 commit comments

Comments
 (0)