Fixes #26896

Fixes the incorrect double assertion check.

Comment From: jhoeller

Since I had myself assigned to the issue, I had a local commit prepared already that I'll include in a larger push towards 5.3.7 this morning, and a 5.2.x backport attached to it.

Thanks for the PR, in any case! In general, please check upfront whether the issue is in the works (or even locally fixed) already. If someone is assigned, that's usually the case.