Follow-up for ca121e20. Fixes #17568. (cherry picked from commit d4488889)
mentioned in commit 376a9f69