Do not throw NPE for equals(null) (#8910)

Change-Id: Ie9a658911c9f2722e518dedbe181c24e5ace07db