Forum: Ruby-core Digest == throws TypeError when testing against nil

8cbb39dadafaf2287a83a13ee4981ec9?d=identicon&s=25 unknown (Guest)
on 2014-08-31 09:12
(Received via mailing list)
Issue #9913 has been updated by Usaku NAKAMURA.

Backport changed from 2.0.0: REQUIRED, 2.1: DONE to 2.0.0: DONE, 2.1:

backported into `ruby_2_0_0` at r47333.

Bug #9913: Digest == throws TypeError when testing against nil

* Author: Bryan Hockey
* Status: Closed
* Priority: Normal
* Assignee:
* Category: lib
* Target version:
* ruby -v: ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
* Backport: 2.0.0: DONE, 2.1: DONE
Also present in ruby -v: jruby 1.7.10 (1.9.3p392) 2014-01-09 c4ecd6b on
OpenJDK 64-Bit Server VM 1.7.0_55-b14 [linux-amd64]

To recreate:

require 'digest'
x =
x == nil
TypeError: can't convert nil into String

w1: use #nil?
w2: reverse rhs, lhs, e.g. if nil == some_digest
This topic is locked and can not be replied to.