summaryrefslogtreecommitdiff
path: root/lib/cgi/session.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/cgi/session.rb')
-rw-r--r--lib/cgi/session.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/cgi/session.rb b/lib/cgi/session.rb
index fbb42986a4..5afc7e69aa 100644
--- a/lib/cgi/session.rb
+++ b/lib/cgi/session.rb
@@ -406,8 +406,8 @@ class CGI
@hash[CGI::unescape(k)] = Marshal.restore(CGI::unescape(v))
end
ensure
- f.close unless f.nil?
- lockf.close if lockf
+ f&.close
+ lockf&.close
end
end
@hash
@@ -426,8 +426,8 @@ class CGI
f.close
File.rename @path+".new", @path
ensure
- f.close if f
- lockf.close if lockf
+ f&.close
+ lockf&.close
end
end