Fixes #2333 exception on comparison with missing id.
Merge pull request #2334 from slawo/3.6.x

Fixes #2333 exception on comparison with missing id.